Skip to content

Commit 78d94eb

Browse files
committed
speed up auto sync service tests
1 parent e942645 commit 78d94eb

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/vs/platform/userDataSync/common/userDataAutoSyncService.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,15 @@ export class UserDataAutoSyncService extends Disposable implements IUserDataAuto
139139
await this.autoSync.value.sync('Activity');
140140
}
141141
}, this.successiveFailures
142-
? 1000 * 1 * Math.min(Math.pow(2, this.successiveFailures), 60) /* Delay exponentially until max 1 minute */
143-
: 1000); /* Debounce for a second if there are no failures */
142+
? this.getSyncTriggerDelayTime() * 1 * Math.min(Math.pow(2, this.successiveFailures), 60) /* Delay exponentially until max 1 minute */
143+
: this.getSyncTriggerDelayTime());
144144

145145
}
146146

147+
protected getSyncTriggerDelayTime(): number {
148+
return 1000; /* Debounce for a second if there are no failures */
149+
}
150+
147151
}
148152

149153
class AutoSync extends Disposable {

src/vs/platform/userDataSync/test/common/userDataAutoSyncService.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { IUserDataSyncService, SyncResource, IUserDataSyncEnablementService } fr
1111

1212
class TestUserDataAutoSyncService extends UserDataAutoSyncService {
1313
protected startAutoSync(): boolean { return false; }
14+
protected getSyncTriggerDelayTime(): number { return 50; }
1415
}
1516

1617
suite('UserDataAutoSyncService', () => {

0 commit comments

Comments
 (0)