Skip to content

Commit ca0d41f

Browse files
Merge pull request #1813 from eifory/fix-task-scheduling-branch
docs(common): fix task-scheduling docs misleading
2 parents ac13e58 + 097a546 commit ca0d41f

File tree

2 files changed

+25277
-178
lines changed

2 files changed

+25277
-178
lines changed

content/techniques/task-scheduling.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ addCronJob(name: string, seconds: string) {
260260
this.logger.warn(`time (${seconds}) for job ${name} to run!`);
261261
});
262262

263-
this.scheduler.addCronJob(name, job);
263+
this.schedulerRegistry.addCronJob(name, job);
264264
job.start();
265265

266266
this.logger.warn(
@@ -277,7 +277,7 @@ In this code, we use the `CronJob` object from the `cron` package to create the
277277

278278
```typescript
279279
deleteCron(name: string) {
280-
this.scheduler.deleteCronJob(name);
280+
this.schedulerRegistry.deleteCronJob(name);
281281
this.logger.warn(`job ${name} deleted!`);
282282
}
283283
```
@@ -286,7 +286,7 @@ deleteCron(name: string) {
286286

287287
```typescript
288288
getCrons() {
289-
const jobs = this.scheduler.getCronJobs();
289+
const jobs = this.schedulerRegistry.getCronJobs();
290290
jobs.forEach((value, key, map) => {
291291
let next;
292292
try {
@@ -325,7 +325,7 @@ addInterval(name: string, milliseconds: number) {
325325
};
326326

327327
const interval = setInterval(callback, milliseconds);
328-
this.scheduler.addInterval(name, interval);
328+
this.schedulerRegistry.addInterval(name, interval);
329329
}
330330
```
331331

@@ -336,7 +336,7 @@ That method takes two arguments: a name for the interval, and the interval itsel
336336

337337
```typescript
338338
deleteInterval(name: string) {
339-
this.scheduler.deleteInterval(name);
339+
this.schedulerRegistry.deleteInterval(name);
340340
this.logger.warn(`Interval ${name} deleted!`);
341341
}
342342
```
@@ -345,7 +345,7 @@ deleteInterval(name: string) {
345345

346346
```typescript
347347
getIntervals() {
348-
const intervals = this.scheduler.getIntervals();
348+
const intervals = this.schedulerRegistry.getIntervals();
349349
intervals.forEach(key => this.logger.log(`Interval: ${key}`));
350350
}
351351
```
@@ -374,7 +374,7 @@ addTimeout(name: string, milliseconds: number) {
374374
};
375375

376376
const timeout = setTimeout(callback, milliseconds);
377-
this.scheduler.addTimeout(name, timeout);
377+
this.schedulerRegistry.addTimeout(name, timeout);
378378
}
379379
```
380380

@@ -385,7 +385,7 @@ That method takes two arguments: a name for the timeout, and the timeout itself.
385385

386386
```typescript
387387
deleteTimeout(name: string) {
388-
this.scheduler.deleteTimeout(name);
388+
this.schedulerRegistry.deleteTimeout(name);
389389
this.logger.warn(`Timeout ${name} deleted!`);
390390
}
391391
```
@@ -394,7 +394,7 @@ deleteTimeout(name: string) {
394394

395395
```typescript
396396
getTimeouts() {
397-
const timeouts = this.scheduler.getTimeouts();
397+
const timeouts = this.schedulerRegistry.getTimeouts();
398398
timeouts.forEach(key => this.logger.log(`Timeout: ${key}`));
399399
}
400400
```

0 commit comments

Comments
 (0)