});
BootstrapFrontend.setup({
- backgroundQueueUrl: '{link controller="BackgroundQueuePerform"}{/link}',
+ backgroundQueue: {
+ url: '{link controller="BackgroundQueuePerform"}{/link}',
+ force: {if $forceBackgroundQueuePerform|isset}true{else}false{/if}
+ },
styleChanger: {if $__wcf->getStyleHandler()->countStyles() > 1}true{else}false{/if}
});
});
}
this._initUserPopover();
- this._invokeBackgroundQueue(options.backgroundQueueUrl);
+ this._invokeBackgroundQueue(options.backgroundQueue.url, options.backgroundQueue.force);
},
/**
* Invokes the background queue roughly every 10th request.
*
* @param {string} url background queue url
+ * @param {boolean} force whether execution should be forced
*/
- _invokeBackgroundQueue: function(url) {
- if (Math.random() < 0.1) {
+ _invokeBackgroundQueue: function(url, force) {
+ if (Math.random() < 0.1 || force) {
// 'fire and forget' background queue perform task
Ajax.apiOnce({
url: url,
* @category Community Framework
*/
class BackgroundQueueHandler extends SingletonFactory {
+ /**
+ * Forces checking whether a background queue item is due.
+ * This means that the AJAX request to BackgroundQueuePerformAction is triggered.
+ */
+ public function forceCheck() {
+ WCF::getTPL()->assign([
+ 'forceBackgroundQueuePerform' => true
+ ]);
+ }
+
/**
* Enqueues the given job(s) for execution in the specified number of
* seconds. Defaults to "as soon as possible" (0 seconds).