@twin.org/background-task-scheduler 0.0.2-next.3 → 0.0.2-next.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -76,7 +76,7 @@ class TaskSchedulerService {
76
76
  id: taskId
77
77
  }
78
78
  });
79
- this.startTimer();
79
+ await this.startTimer();
80
80
  }
81
81
  /**
82
82
  * Remove a task from the scheduler.
@@ -139,8 +139,11 @@ class TaskSchedulerService {
139
139
  * Start the timer for running scheduled tasks.
140
140
  * @internal
141
141
  */
142
- startTimer() {
142
+ async startTimer() {
143
143
  if (core.Is.empty(this._timer)) {
144
+ // Trigger immediately to catch up on any missed tasks
145
+ await this.triggerScheduledTasks();
146
+ // Set the timer to run at the specified interval
144
147
  this._timer = setInterval(async () => this.triggerScheduledTasks(), this._tickInterval);
145
148
  }
146
149
  }
@@ -74,7 +74,7 @@ class TaskSchedulerService {
74
74
  id: taskId
75
75
  }
76
76
  });
77
- this.startTimer();
77
+ await this.startTimer();
78
78
  }
79
79
  /**
80
80
  * Remove a task from the scheduler.
@@ -137,8 +137,11 @@ class TaskSchedulerService {
137
137
  * Start the timer for running scheduled tasks.
138
138
  * @internal
139
139
  */
140
- startTimer() {
140
+ async startTimer() {
141
141
  if (Is.empty(this._timer)) {
142
+ // Trigger immediately to catch up on any missed tasks
143
+ await this.triggerScheduledTasks();
144
+ // Set the timer to run at the specified interval
142
145
  this._timer = setInterval(async () => this.triggerScheduledTasks(), this._tickInterval);
143
146
  }
144
147
  }
package/docs/changelog.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.2-next.4](https://github.com/twinfoundation/background-task/compare/background-task-scheduler-v0.0.2-next.3...background-task-scheduler-v0.0.2-next.4) (2025-07-23)
4
+
5
+
6
+ ### Features
7
+
8
+ * background tasks immediately trigger ([a0a847b](https://github.com/twinfoundation/background-task/commit/a0a847ba9686adcd0460e810540959f87dcaeab1))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/background-task-models bumped from 0.0.2-next.3 to 0.0.2-next.4
16
+
3
17
  ## [0.0.2-next.3](https://github.com/twinfoundation/background-task/compare/background-task-scheduler-v0.0.2-next.2...background-task-scheduler-v0.0.2-next.3) (2025-07-21)
4
18
 
5
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/background-task-scheduler",
3
- "version": "0.0.2-next.3",
3
+ "version": "0.0.2-next.4",
4
4
  "description": "Background task scheduler",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,7 +14,7 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/background-task-models": "0.0.2-next.3",
17
+ "@twin.org/background-task-models": "0.0.2-next.4",
18
18
  "@twin.org/core": "next",
19
19
  "@twin.org/logging-models": "next",
20
20
  "@twin.org/nameof": "next"