Skip to content

Commit

Permalink
🐛 Fix TaskService#initSchedules() attempting to recreate already ex…
Browse files Browse the repository at this point in the history
…isting system schedules
  • Loading branch information
skerit committed Nov 4, 2023
1 parent 48b337b commit 98dc7c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Move `Model#beforeSave()` to after validation
* Make the `Decimal` classes globally available
* Allow passing a custom context to `PathEvaluator#getValue(context)`
* Fix `TaskService#initSchedules()` attempting to recreate already existing system schedules

## 1.3.19 (2023-10-18)

Expand Down
5 changes: 4 additions & 1 deletion lib/class/task_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Service.setMethod(function checksumSystemSchedule(type_path, cron, settings) {
*
* @author Jelle De Loecker <jelle@elevenways.be>
* @since 1.3.17
* @version 1.3.17
* @version 1.3.20
*/
Service.setMethod(async function initSchedules() {

Expand Down Expand Up @@ -179,6 +179,7 @@ Service.setMethod(async function initSchedules() {
// If this checksum has already been seen, also remove it
if (existing_system_records.has(checksum)) {
await record.remove();
continue;
}

// Update the record
Expand All @@ -188,6 +189,8 @@ Service.setMethod(async function initSchedules() {

await record.save();

existing_system_records.set(checksum, record);

} catch (err) {
alchemy.registerError(err);
}
Expand Down

0 comments on commit 98dc7c5

Please sign in to comment.