Commit b302b4c7 authored by Mugdha Lakhani's avatar Mugdha Lakhani Committed by Commit Bot

[Background Sync] Show updated delay in Devtools.

We sometimes change the actual delay after which a periodicsync event is fired
based on other registrations for the origin. Update what we show in Devtools so
it corresponds to the actual delay_until set on the registration.

Bug: 989524
Change-Id: I9ba06f9c5f65d93775b0a9bf9d934f1d9b5b5ce6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1730921Reviewed-by: default avatarRayan Kanso <rayankans@chromium.org>
Commit-Queue: Mugdha Lakhani <nator@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683298}
parent fd43b5ea
......@@ -918,7 +918,8 @@ void BackgroundSyncManager::RegisterDidGetDelay(
DevToolsBackgroundService::kPeriodicBackgroundSync,
/* event_name= */ "Got next event delay",
/* instance_id= */ registration.options()->tag,
{{"Next Attempt Delay (ms)", GetDelayAsString(delay)}});
{{"Next Attempt Delay (ms)",
GetDelayAsString(registration.delay_until() - clock_->Now())}});
}
AddOrUpdateActiveRegistration(
......@@ -1980,7 +1981,8 @@ void BackgroundSyncManager::EventCompleteDidGetDelay(
std::string event_name = GetSyncEventName(registration->sync_type()) +
(succeeded ? " event completed" : " event failed");
std::map<std::string, std::string> event_metadata = {
{"Next Attempt Delay (ms)", GetDelayAsString(delay)}};
{"Next Attempt Delay (ms)",
GetDelayAsString(registration->delay_until() - clock_->Now())}};
if (!succeeded) {
event_metadata.emplace("Failure Reason",
GetEventStatusString(status_code));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment