Skip to content

Commit

Permalink
Merge pull request #330 from roggervalf/feature-retry-delayed-jobs
Browse files Browse the repository at this point in the history
Retry bulk delayed jobs
  • Loading branch information
bradvogel authored Mar 2, 2021
2 parents f5fb4b3 + 3ea933b commit 1dac2d7
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 6 deletions.
8 changes: 6 additions & 2 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Overview

This is a simple demonstration of how to run Arena and connect it to [Bee Queue](https://github.com/mixmaxhq/bee-queue).
This is a simple demonstration of how to run Arena and connect it to [Bee Queue](https://github.com/mixmaxhq/bee-queue) or [Bull Queue](https://github.com/OptimalBits/bull).

## Requirements

Expand All @@ -13,6 +13,10 @@ This is a simple demonstration of how to run Arena and connect it to [Bee Queue]

## Running

`npm start`
`npm start:bee`

or

`npm start:bull`

Then open http://localhost:4735/ in your browser.
File renamed without changes.
46 changes: 46 additions & 0 deletions example/bull.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const Arena = require('../');
const Bull = require('bull');
const RedisServer = require('redis-server');

// Select ports that are unlikely to be used by other services a developer might be running locally.
const HTTP_SERVER_PORT = 4735;
const REDIS_SERVER_PORT = 4736;

// Create a Redis server. This is only for convenience

async function main() {
const server = new RedisServer(REDIS_SERVER_PORT);
await server.open();

Arena(
{
Bull,

queues: [
{
// Required for each queue definition.
name: 'name_of_my_queue',

// User-readable display name for the host. Required.
hostId: 'Queue Server 1',

// Queue type (Bull or Bee - default Bull).
type: 'bull',

redis: {
// host: 'localhost',
port: REDIS_SERVER_PORT,
},
},
],
},
{
port: HTTP_SERVER_PORT,
}
);
}

main().catch((err) => {
console.error(err);
process.exit(1);
});
6 changes: 4 additions & 2 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
"name": "arena-example-project",
"version": "1.0.0",
"description": "An example project that uses Arena",
"main": "index.js",
"main": "bee.js",
"scripts": {
"start": "node index.js",
"start:bee": "node bee.js",
"start:bull": "node bull.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT",
"dependencies": {
"bee-queue": "^1.3.1",
"bull": "^3.20.1",
"express": "^4.17.1",
"redis-server": "^1.2.2"
}
Expand Down
2 changes: 2 additions & 0 deletions src/server/views/dashboard/queueJobsByState.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ async function _html(req, res) {
pages.push(_.last(pages) + 1);
}
pages = pages.filter((page) => page <= _.ceil(jobCounts[state] / pageSize));
const disableRetry = !(state === 'failed' || (state === 'delayed' && !queue.IS_BEE));

return res.render('dashboard/templates/queueJobsByState', {
basePath,
Expand All @@ -133,6 +134,7 @@ async function _html(req, res) {
jobsInStateCount: jobCounts[state],
disablePagination: queue.IS_BEE && (state === 'succeeded' || state === 'failed'),
disableOrdering: queue.IS_BEE,
disableRetry,
currentPage: page,
pages,
pageSize,
Expand Down
4 changes: 2 additions & 2 deletions src/server/views/dashboard/templates/queueJobsByState.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@
data-queue-state="{{ state }}" class="js-bulk-action btn btn-danger">
Remove Jobs
</button>
{{#eq state 'failed'}}
{{#unless disableRetry}}
<button type="button" data-action="retry" data-queue-name="{{ queueName }}" data-queue-host="{{ queueHost }}"
data-queue-state="{{ state }}" class="js-bulk-action btn btn-success">
Retry Jobs
</button>
{{/eq}}
{{/unless}}

<div class="btn-group">
<div class="btn-group">
Expand Down

0 comments on commit 1dac2d7

Please sign in to comment.