Comments (1)
Ultimately, I think we don't have enough classes to represent all the concepts and dependencies that we really want. I think we should probably have the following:
- Connection - for now, just a DatabaseConnection; handles reading and writing to data source
- QueryFilter - applied to a connection to allow it to pull only a specific subset of all entries (e.g. tasks by name, or if we change how we do things it could be a Job class name)
- QueueType (one of Queue, Stack, PriorityQueue) - Handles prioritization of tasks, is essentially an application of a QueryFilter focused primarily on sorting.
- Schedule - (one of Interval or Event) Handles setting up cron schedules or one-off events. We could have existing classes that correspond to the pre-existing cron intervals in WordPress (QuarterHourInterval, HourlyInterval, etc)
- Worker - Takes a connection, schedule, queue type, and (optionally) query filter(s). Handles registration of new tasks, processing tasks, checking task status, recording results, decrementing retries, etc.
- Job/Task - Individual unit of work. We should have a standard way of registering these. I like how the wp-queue package does it. Ideally would be extended for each job type.
- Job/Task Result - Handles storing and fetching of results, mostly standalone, but would rely on a connection type.
I'm looking at this as inspiration: https://github.com/deliciousbrains/wp-queue
I get that this is a bit of an involved rewrite if we do this, so if we need to circle back to this as a fast follow we can.
from wp-module-tasks.
Related Issues (14)
- Update Satis reference in readme file
- Consider making priority optional
- Implement tests
- Avoid use of `phpcs:ignore`
- Drop `Models.php` file since it isn't in use
- Call the `setup_task_*` functions via `register_activation_hook`
- Ensure use of `$wpdb->prepare()`
- Use `set_time_limit()` instead of `ini_set( 'max_execution_time' )`
- Reconsider method of Task instantiation
- Should we be using any additional indexes on our custom tables?
- Remove unused code HOT 2
- What are the use cases for disabling a task? HOT 1
- Restrict when tables checks are done and add code to allow deleting tables as well
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 wp-module-tasks.