26 karma · joined April 3, 2023
Lead Developer of LiteGui - https://litegui.com, an open sourced CMS system.
Firstly, every job gets stored in an activity table with a retry and result column.
If the job should be run instantly without queueing, no queue entry is needed, the retry column is 0 and the result column is filled.
If the job fails for whatever reason, a queue entry containing the activity ID is added to let the queue worker process it later on. When the worker processes the job, the retry column will be incremented no matter of the outcome. If the worker succeeds, the activity will be updated with the result.
If the worker fails to process it and the retry number is less than 5, another queue entry will be added (as the current one is already removed from the queue). When to process that queue entry depends on the retry number, they can be 1m, 5m, 25m, 2.1h, 10.4h, 2.2 days using the following formula:
$interval = 300 * pow(5, ($retry - 1));
This approach also helps in case of queue failure, you can just rebuild the queue from the activity table for entries with no result (or status) and retry number is less than 5.
To be honest, I don't work with queue regularly but I have to implement it anyway. I'm sharing this approach so we all can improve it.
LiteGUI/SiteGUI is a hybrid CMS that caters for both mobile apps and web apps. Every Model/Class will return one or more ViewBlocks that contain API root variable ($api) and optionally HTML helper root variable ($html) that can be consumed by API clients or utilized by the built-in View layer to render HTML from PHP Smarty templates server side. This means no separated API codebase is needed, Models/Classes are and should be developed using API first principle with additional on-demand HTML helpers. The integrated rate limiting engine is also capable of detecting API/non-API requests and applying thresholds accordingly. With this flexibility, LiteGUI/SiteGUI can be used as a stand-alone web app (server side rendering) or serves as the backend for other client side rendering (front-end) frameworks (NextJS, ReactJS etc) and mobile apps.
LiteGUI/SiteGUI is also the first CMS that employs sub-domains/sandboxing for mitigating XSS attacks. As LiteGUI/SiteGUI supports 3rd-party templates/themes, this mitigation strategy helps protect site owners from all types of XSS attacks (stored, reflected or DOM-based) that may (accidentally) be brought into their sites from 3rd party templates/themes. LiteGUI/SiteGUI uses a dedicated sub-domain for managing/submitting sensitive data and another sub-domain (loaded in a frame) for managing arbitrary contents and widgets (sandboxing). The advantage of sandboxing is that LiteGUI/SiteGUI can accept raw HTML content produced by a WYSIWYG editor or even through the browser's developer console, there is no need to use non-HTML editor like Markdown for editing the content. The main domain can display arbitrary contents (produced by site editors) as sensitive write operations are limited on the main domain. Despite using different sub-domains to avoid sharing cookies/authentication, the transitions/experience are seamless as LiteGUI/SiteGUI employs resource-based time-constraint token to automatically pass authenticated user information between sub-domains.
"Let’s apply the example to Commons Clause licensed software. Commons Clause-licensed Redis Graph is a graph database module for BSD-licensed Redis. Can you create applications with Redis Graph and distribute and/or sell them? Yes. Can you redistribute Redis Graph along with your application? Yes. Can you offer that application as SaaS and charge for it? Yes. Can you take Redis Graph itself, call it ElastiGraph and offer it as SaaS and charge for it. No."
It could be that the application developed with Redis Graph is totally different to Redis Graph so SaaS offering is allowed. I will check this further, thanks for your suggestion.