Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce custom interval for checking component update #4991

Merged
merged 1 commit into from
Mar 22, 2020
Merged
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
13 changes: 13 additions & 0 deletions browser/component_updater/brave_component_updater_configurator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
#include <string>
#include <vector>

#include "base/command_line.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/sys_string_conversions.h"
#include "base/version.h"
#include "brave/common/brave_switches.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/net/system_network_context_manager.h"
Expand Down Expand Up @@ -58,6 +61,16 @@ int BraveConfigurator::InitialDelay() const {
}

int BraveConfigurator::NextCheckDelay() const {
auto* command = base::CommandLine::ForCurrentProcess();
if (command->HasSwitch(switches::kComponentUpdateIntervalInSec)) {
int interval = 0;
if (base::StringToInt(command->GetSwitchValueASCII(
switches::kComponentUpdateIntervalInSec),
&interval)) {
DCHECK_GE(interval, 1);
return interval;
}
}
return configurator_impl_.NextCheckDelay();
}

Expand Down
3 changes: 3 additions & 0 deletions common/brave_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,7 @@ const char kFastWidevineBundleUpdate[] = "fast-widevine-bundle-update";

const char kUseGoUpdateDev[] = "use-dev-goupdater-url";

// Use custom update interval in sec
const char kComponentUpdateIntervalInSec[] = "component-update-interval-in-sec";

} // namespace switches
2 changes: 2 additions & 0 deletions common/brave_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ extern const char kFastWidevineBundleUpdate[];

extern const char kUseGoUpdateDev[];

extern const char kComponentUpdateIntervalInSec[];

} // namespace switches

#endif // BRAVE_COMMON_BRAVE_SWITCHES_H_