Comments (4)
Instead of using callbacks
Perhaps I'm missing a particular use-case but generally Active Support notifications are not a substitution for callbacks. A callback is something that is specific to a single maintenance task and will go away along with the task while notifications subscriptions will most likely stay in the application itself as it will be global for all tasks. Also the execution context is different, callbacks are executed within the task itself which means you can access data available in the task or choose how the task should proceed with the execution. While a notification is a fact of an event with no control on the even itself and the context is limited by the values passed along with the notification.
Having said that, I still think that it might be reasonable to have active support notifications added to maintenance tasks. However, since maintenance_tasks
is using job-iteration
(https://github.com/Shopify/job-iteration) under the hood - it already has all notifications issued by job-iteration
, for example - https://github.com/Shopify/job-iteration/blob/c5c299af110bceff60091c5bfec8e2353b069198/lib/job-iteration/iteration.rb#L140
The naming like build_enumerator.iteration
is not the friendliest in scope of the maintenance tasks gem as it requires some internal knowledge of job-iteration
while maintenance tasks is trying to provide a higher-level API for job-iteration so maybe mirroring job-iteration notifications in maintenance tasks is reasonable assuming that this improves the UX and removes the need to be aware of job-iteration
internals without necessity.
from maintenance_tasks.
A callback is something that is specific to a single maintenance task and will go away along with the task
That doesn't seem to be what's hinted at in the readme:
https://github.com/Shopify/maintenance_tasks/blob/main/README.md?plain=1#L378-L391
from maintenance_tasks.
That doesn't seem to be what's hinted at in the readme
This is just a way to mass-define a callback. It's fair that in this case the callback won't go away with the deletion of the task but execution wise it still stays specific to a given task. So a callback is something that is attached to a task when it comes to an execution and a notification subscriber is something that exists in an application and just listens for events. Ultimately in an application there could be two maintenance tasks frameworks that issue the same notifications on similar events while callbacks will have to be duplicated in both of them even if it's going to be a single meta-programming solution that evals code in parent classes. This is why I don't consider notifications to be a complete substitution to callbacks. We should have both
from maintenance_tasks.
This issue has been marked as stale because it has not been commented on in two months.
Please reply in order to keep the issue open. Otherwise, it will close in 14 days.
Thank you for contributing!
from maintenance_tasks.
Related Issues (20)
- Weekly CI run failed
- Dangerous query method (method whose arguments are used as raw SQL) called with non-attribute argument(s) HOT 2
- Multiple database shards HOT 3
- How do we set `limit`? HOT 8
- No callback is called after Interrupted -> Resumed HOT 5
- Release notes HOT 1
- Web UI and Rails API mode HOT 2
- CSV Task Failure: ActiveRecord::NotNullViolation Error on UUID record_id HOT 2
- please add a CHANGELOG.md file HOT 4
- Weekly CI run failed
- Weekly CI run failed HOT 1
- Weekly CI run failed HOT 1
- Weekly CI run failed HOT 1
- CSV count wrong when new line in cell HOT 8
- Weekly CI run failed HOT 1
- Sorbet typing in templates HOT 1
- Figure out slow system tests
- Ensure `Rack::MethodOverride` HOT 5
- Weekly CI run failed
- Weekly CI run failed HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from maintenance_tasks.