You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Celery: use an internal namespace to store build task's data
Use a `Task.data` (`readthedocs.projects.task.builds.TaskData` object) to store
all the data the task needs to work instead of storing it directly using
`self.`.
This is to allow us a simpler way to perform a clean _before_ (and/or _after_)
starting the execution of a new task and avoid potentially sharing state with a
previous task executed that may not be able to perform the cleanup.
The only thing we need to keep in mind is that when modifying these Celery
tasks, we _always_ have to add any new value inside the
`self.data.<my-new-attribute>` and not directly `self.<my-new-attribute>` to
avoid this problem. In the future, we could implement this protection at a code
level if we want to avoid this mistake.
See #8815 (comment)
See https://docs.celeryproject.org/en/master/userguide/tasks.html#instantiation
0 commit comments