Skip to content

Channel is already publishing-- revert late acknowledgment #3968

@sentry

Description

@sentry

Summary

If async tasks aren't acknowledged within a certain amount of time, celery will redeliver them to a worker, which means more than one worker could be attempting to process channel changes (like publishing) at a time, resulting in the error below. Currently, tasks are configured to acknowledge 'late' meaning they're acknowledged once completed. This is a helpful feature if workers crash, go offline, or are interrupted by a release, since it means those tasks will be redelivered. But if a task takes a long time, then those could cause inadvertent problems from the concurrency.

### Tasks
- [x] Change back to early acknowledgment
- [x] Add a new management command `reconcile_publishing_status`, similar to [`reconcile_change_tasks`](https://github.com/learningequality/studio/blob/unstable/contentcuration/contentcuration/management/commands/reconcile_change_tasks.py) which compares a channel's publishing status with any unapplied publishing change events or the presence of any queued or running `apply_channel_changes_task`s for the same channel and resets the publishing status if there are none
- [x] Add a makefile target `reconcile` which will call both `reconcile_*` commands, for use in a k8s cron job

Sentry Issue: STUDIO-FC5

ValidationError: [ErrorDetail(string='Channel is already publishing', code='invalid')]
  File "contentcuration/viewsets/channel.py", line 467, in publish_from_changes
    self.publish(
  File "contentcuration/viewsets/channel.py", line 484, in publish
    raise ValidationError("Channel is already publishing")

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions