Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion build.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
a:hover {
text-decoration: underline;
}
select, button {
select, button, input {
border: 1px solid var(--color-select-border);
background-color: var(--background);
color: var(--color);
Expand Down Expand Up @@ -264,6 +264,14 @@
<label><input type="checkbox" id="buildRootCheckbox" onchange="onOptionsChanged()"/>Build from root user (not recommended).</label>
</div>

<div id="buildMultiCoreDiv" class="hide">
<label><input type="checkbox" id="buildMultiCoreCheckbox" onchange="onOptionsChanged()"/>Build using mulitple cores<span class="hide" id="buildMultiCoreColon">:</span></label>

<div id="buildMultiCoreInputDiv" class="hide">
<input type="number" id="buildMultiCoreInput" onchange="onOptionsChanged()" placeholder="Cores number" min="1" style="text-align: center;"/>
</div>
</div>

<p></p>
</div>

Expand Down Expand Up @@ -352,6 +360,7 @@
linux_distro = document.getElementById('linuxSelect').value;
}
document.getElementById('buildCommandsDiv').style.display = 'block';
document.getElementById('buildMultiCoreDiv').style.display = 'block';

var use_clang = os_freebsd || os_openbsd;
if (os_linux && linux_distro !== 'Alpine' && !linux_distro.includes('CentOS') && !linux_distro.includes('Fedora')) {
Expand Down Expand Up @@ -667,6 +676,11 @@
commands.push('cd ../build');
}
let build_command = cmake + ' --build . --target install';

if (document.getElementById('buildMultiCoreCheckbox').checked && document.getElementById('buildMultiCoreInput').value.toString().length > 0 && !(isNaN(document.getElementById('buildMultiCoreInput').value))) {
build_command += ` -j ${ document.getElementById('buildMultiCoreInput').value }`;
}

if (use_msvc) {
if (!is_debug_build) {
commands.push(build_command + ' --config Release');
Expand All @@ -685,6 +699,8 @@
if (install_dir !== '/usr/local') {
install_dir = 'telegram-bot-api';
}
document.getElementById('buildMultiCoreInputDiv').style.display = document.getElementById('buildMultiCoreCheckbox').checked ? 'block' : 'none';
document.getElementById('buildMultiCoreColon').style.display = document.getElementById('buildMultiCoreCheckbox').checked ? 'inline' : 'none';
commands.push((use_powershell ? 'dir ' : 'ls -l ') + install_dir + '/bin/telegram-bot-api*');
document.getElementById('buildCommands').innerHTML = '<ul><li>' + commands.join('</li><li>') + '</li></ul>';
document.getElementById('copyBuildCommandsButton').style.display = commands.includes('exit') ? 'none' : 'block';
Expand Down
6 changes: 3 additions & 3 deletions telegram-bot-api/telegram-bot-api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ int main(int argc, char *argv[]) {
.release();
}

constexpr double WATCHDOG_TIMEOUT = 0.25;
constexpr double WATCHDOG_TIMEOUT = 100.0; // kick every WATCHDOG_TIMEOUT/10 = 10s; effectively disables watchdog
auto watchdog_id = sched.create_actor_unsafe<Watchdog>(SharedData::get_watchdog_scheduler_id(), "Watchdog",
td::this_thread::get_id(), WATCHDOG_TIMEOUT);

Expand Down Expand Up @@ -590,10 +590,10 @@ int main(int argc, char *argv[]) {

double now = td::Time::now();
if (now >= next_cron_time) {
if (now >= next_cron_time + 1.0) {
if (now >= next_cron_time + 10.0) {
next_cron_time = now;
}
next_cron_time += 1.0;
next_cron_time += 10.0; // collect CPU usage statistics every 10s instead of 1s
auto guard = sched.get_main_guard();
td::Scheduler::instance()->run_on_scheduler(SharedData::get_statistics_thread_id(),
[](td::Unit) { ServerCpuStat::update(td::Time::now()); });
Expand Down