()
| 172 | |
| 173 | if(shouldExecute){ |
| 174 | const execute = async () => { |
| 175 | try { |
| 176 | this.runCount++; |
| 177 | execution.startedAt = new Date(); |
| 178 | const result = await this.onMatch(date, execution); |
| 179 | execution.finishedAt = new Date(); |
| 180 | execution.result = result; |
| 181 | this.onFinished(date, execution); |
| 182 | |
| 183 | if( this.maxExecutions && this.runCount >= this.maxExecutions){ |
| 184 | this.onMaxExecutions(date); |
| 185 | this.stop(); |
| 186 | } |
| 187 | } catch (error: any){ |
| 188 | execution.finishedAt = new Date(); |
| 189 | execution.error = error; |
| 190 | this.onError(date, error, execution); |
| 191 | } |
| 192 | |
| 193 | resolve(true); |
| 194 | }; |
| 195 | |
| 196 | // The jitter timer only earns its macrotask hop when a random delay is |
| 197 | // actually configured. With the default maxRandomDelay of 0 the delay |
nothing calls this directly
no test coverage detected