-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d19f7c
commit ca861e6
Showing
4 changed files
with
54 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Timer } from '../utilities/timer'; | ||
|
||
export class StragglerTimer { | ||
private timers: Set<Timer> = new Set(); | ||
|
||
startTimer(time: number, callback: () => void) { | ||
const timer = new Timer(); | ||
const myCallback = () => { | ||
this.timers.delete(timer); | ||
callback(); | ||
}; | ||
timer.startTimer(time, callback); | ||
this.timers.add(timer); | ||
} | ||
|
||
stopTimers() { | ||
this.timers.forEach((timer) => timer.stopTimer()); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...etwork-manager/consensus-timer-manager.ts → src/utilities/timer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters