Giter Site home page Giter Site logo

Comments (1)

wpscholar avatar wpscholar commented on July 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.