@platformatic/watt-extra 1.16.0 → 1.17.0
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.
- package/.github/workflows/test.yml +2 -2
- package/lib/errors.js +7 -1
- package/lib/utils.js +1 -10
- package/lib/watt.js +17 -2
- package/package.json +14 -15
- package/plugins/env.js +3 -1
- package/plugins/flamegraphs.js +386 -59
- package/plugins/update.js +15 -0
- package/test/profiling-toggle.test.js +746 -0
- package/test/scheduler-coordination.test.js +7 -2
- package/test/scheduler.test.js +15 -11
|
@@ -122,9 +122,14 @@ test('ICC coordination: should disable local jobs regardless of scheduler mode',
|
|
|
122
122
|
await icc.close()
|
|
123
123
|
})
|
|
124
124
|
|
|
125
|
-
// ICC coordination always disables local execution
|
|
125
|
+
// ICC coordination always disables local execution: released runtimes
|
|
126
|
+
// disable the job in config, runtimes with scheduler control pause it.
|
|
126
127
|
const config = await app.watt.runtime.getRuntimeConfig()
|
|
127
|
-
|
|
128
|
+
if (typeof app.watt.runtime.pauseSchedulerJob === 'function') {
|
|
129
|
+
assert.strictEqual(app.watt.runtime.getScheduler()[0].paused, true)
|
|
130
|
+
} else {
|
|
131
|
+
assert.strictEqual(config.scheduler[0].enabled, false)
|
|
132
|
+
}
|
|
128
133
|
|
|
129
134
|
assert.ok(savedWattJob)
|
|
130
135
|
})
|
package/test/scheduler.test.js
CHANGED
|
@@ -46,17 +46,21 @@ test('should spawn a runtime disabling all the scheduler jobs', async (t) => {
|
|
|
46
46
|
|
|
47
47
|
const { scheduler } = config
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
49
|
+
if (typeof app.watt.runtime.pauseSchedulerJob === 'function') {
|
|
50
|
+
// Runtimes exposing scheduler control keep the job enabled in config and
|
|
51
|
+
// pause it at runtime instead of disabling it.
|
|
52
|
+
assert.notStrictEqual(scheduler[0].enabled, false)
|
|
53
|
+
} else {
|
|
54
|
+
// Legacy runtimes disable the job in the config patch.
|
|
55
|
+
assert.deepStrictEqual(scheduler, [{
|
|
56
|
+
enabled: false,
|
|
57
|
+
name: 'test',
|
|
58
|
+
callbackUrl: 'http://localhost:3000',
|
|
59
|
+
cron: '*/5 * * * *',
|
|
60
|
+
method: 'GET',
|
|
61
|
+
maxRetries: 3
|
|
62
|
+
}])
|
|
63
|
+
}
|
|
60
64
|
|
|
61
65
|
// ICC is called to save the job
|
|
62
66
|
const expectedWattJob = {
|