Skip to content

Backup and reset MWL on a schedule - #76

Merged
carlosmartinez merged 3 commits into
mainfrom
feat/backup-reset-mwl
Apr 13, 2026
Merged

Backup and reset MWL on a schedule#76
carlosmartinez merged 3 commits into
mainfrom
feat/backup-reset-mwl

Conversation

@carlosmartinez

Copy link
Copy Markdown
Contributor

The worklist is inherently ephemeral. Stale worklist items from a previous day are not meaningful to the modality and could cause confusion if they appeared in a C-FIND response.

Therefore we backup and reset the MWL database on a configurable schedule (default: daily at 02:00 UTC).

The schedule is configured via a cron expression stored in an env var (MWL_RESET_SCHEDULE).

Jira link

https://nhsd-jira.digital.nhs.uk/browse/DTOSS-12566

The worklist is inherently ephemeral. Stale worklist items from a previous day are not meaningful to the modality and could cause confusion if they appeared in a C-FIND response.

Therefore we backup and reset the MWL database on a configurable schedule (default: daily at 02:00 UTC).
+
The schedule is configured via a cron expression stored in an env var (`MWL_RESET_SCHEDULE`).
@carlosmartinez
carlosmartinez requested a review from steventux April 2, 2026 13:18

@steventux steventux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we are taking this app level approach to scheduling we need to remove the batch scripts which set up the window scheduler tasks scheduling the original database backups.

@carlosmartinez
carlosmartinez force-pushed the feat/backup-reset-mwl branch from 21a5a69 to febe6c7 Compare April 9, 2026 07:53

@steventux steventux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced that bringing backup/clear db functionality into the service layer is particularly clean.
Perhaps it's a remnant of the application-level scheduling introduced in this PR initially but it feels like an interface for something that happens outside the running of any application logic.
This feature is somewhat equivalent to a django admin task or a make task which don't typically live deep in application code, I think we can still test a script form of database backup.

@carlosmartinez

Copy link
Copy Markdown
Contributor Author

I'm not convinced that bringing backup/clear db functionality into the service layer is particularly clean. Perhaps it's a remnant of the application-level scheduling introduced in this PR initially but it feels like an interface for something that happens outside the running of any application logic. This feature is somewhat equivalent to a django admin task or a make task which don't typically live deep in application code, I think we can still test a script form of database backup.

Thanks Steve. That's reasonable. Have pushed an update with logic shifted away from the application layer.

@steventux steventux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ 🟢 ♻️ 🟢 ♻️ 🟢 ♻️ 🟢

@carlosmartinez
carlosmartinez merged commit b06d93b into main Apr 13, 2026
9 checks passed
@carlosmartinez
carlosmartinez deleted the feat/backup-reset-mwl branch April 13, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants