Commit 2d6f6f2a 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, 990207
Change-Id: Ie74b5cf1c4e48d58fb1b165aec54597cc018bc71
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1733487Reviewed-by: default avatarRayan Kanso <rayankans@chromium.org>
Commit-Queue: Mugdha Lakhani <nator@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683636}
parent 2890796e
......@@ -919,7 +919,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,8 +1981,12 @@ void BackgroundSyncManager::EventCompleteDidGetDelay(
std::string event_name = GetSyncEventName(registration->sync_type()) +
(succeeded ? " event completed" : " event failed");
base::TimeDelta display_delay =
registration->sync_type() == BackgroundSyncType::ONE_SHOT
? delay
: registration->delay_until() - clock_->Now();
std::map<std::string, std::string> event_metadata = {
{"Next Attempt Delay (ms)", GetDelayAsString(delay)}};
{"Next Attempt Delay (ms)", GetDelayAsString(display_delay)}};
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