11import { Identifiers } from "@mainsail/constants" ;
22import { inject , injectable } from "@mainsail/container" ;
33import type { Contracts } from "@mainsail/contracts" ;
4+ import { setTimeoutAsync } from "@mainsail/utils" ;
45import dayjs from "dayjs" ;
56
67@injectable ( )
@@ -33,7 +34,7 @@ export class Scheduler implements Contracts.Consensus.Scheduler {
3334
3435 const timeout = Math . max ( 0 , timestamp - dayjs ( ) . valueOf ( ) ) ;
3536
36- this . #timeoutStartRound = setTimeout ( async ( ) => {
37+ this . #timeoutStartRound = setTimeoutAsync ( async ( ) => {
3738 await this . #getConsensus( ) . onTimeoutStartRound ( ) ;
3839 this . #timeoutStartRound = undefined ;
3940 } , timeout ) ;
@@ -46,7 +47,7 @@ export class Scheduler implements Contracts.Consensus.Scheduler {
4647 return false ;
4748 }
4849
49- this . #timeoutPropose = setTimeout ( async ( ) => {
50+ this . #timeoutPropose = setTimeoutAsync ( async ( ) => {
5051 await this . #getConsensus( ) . onTimeoutPropose ( height , round ) ;
5152 this . #timeoutPropose = undefined ;
5253 } , this . #getTimeout( round ) ) ;
@@ -59,7 +60,7 @@ export class Scheduler implements Contracts.Consensus.Scheduler {
5960 return false ;
6061 }
6162
62- this . #timeoutPrevote = setTimeout ( async ( ) => {
63+ this . #timeoutPrevote = setTimeoutAsync ( async ( ) => {
6364 await this . #getConsensus( ) . onTimeoutPrevote ( height , round ) ;
6465 this . #timeoutPrevote = undefined ;
6566 } , this . #getTimeout( round ) ) ;
@@ -72,7 +73,7 @@ export class Scheduler implements Contracts.Consensus.Scheduler {
7273 return false ;
7374 }
7475
75- this . #timeoutPrecommit = setTimeout ( async ( ) => {
76+ this . #timeoutPrecommit = setTimeoutAsync ( async ( ) => {
7677 await this . #getConsensus( ) . onTimeoutPrecommit ( height , round ) ;
7778 this . #timeoutPrecommit = undefined ;
7879 } , this . #getTimeout( round ) ) ;
0 commit comments