Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions public/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -519,4 +519,31 @@ $(document).ready(() => {
$(this).prop('disabled', false);
}
});

$('.js-remove-rate-limit-key').on('click', function (e) {
e.preventDefault();
const queueName = $(this).data('queue-name');
const queueHost = $(this).data('queue-host');

const response = window.confirm(
`Are you sure you want to remove the Rate Limit key for the queue "${queueHost}/${queueName}"?`
);
if (response) {
$.ajax({
method: 'DELETE',
url: `${basePath}/api/queue/${encodeURIComponent(
queueHost
)}/${encodeURIComponent(queueName)}/rate-limit-key`,
})
.done(() => {
window.location.reload();
})
.fail((jqXHR) => {
window.alert(`Request failed, check console for error.`);
console.error(jqXHR.responseText);
});
} else {
$(this).prop('disabled', false);
}
});
});
Binary file modified screenshots/screen1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/screen1_sm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/server/views/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const bulkJobsRetry = require('./bulkJobsRetry');
const queuePause = require('./queuePause');
const queueResume = require('./queueResume');
const queueUpdateMeta = require('./queueUpdateMeta');
const queueRemoveRateLimitKey = require('./queueRemoveRateLimitKey');

router.post('/queue/:queueHost/:queueName/job', jobAdd);
router.post('/flow/:flowHost/:connectionName/flow', addFlow);
Expand All @@ -34,5 +35,9 @@ router.put('/queue/:queueHost/:queueName/resume', queueResume);
router.put('/queue/:queueHost/:queueName/update-meta', queueUpdateMeta);
router.delete('/queue/:queueHost/:queueName/job/:id', jobRemove);
router.delete('/queue/:queueHost/:queueName/jobs/bulk', bulkJobsClean);
router.delete(
'/queue/:queueHost/:queueName/rate-limit-key',
queueRemoveRateLimitKey
);

module.exports = router;
17 changes: 17 additions & 0 deletions src/server/views/api/queueRemoveRateLimitKey.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
async function handler(req, res) {
const {queueName, queueHost} = req.params;

const {Queues} = req.app.locals;

const queue = await Queues.get(queueName, queueHost);
if (!queue) return res.status(404).json({error: 'queue not found'});

try {
await queue.removeRateLimitKey();
} catch (err) {
return res.status(500).json({error: err.message});
}
return res.sendStatus(200);
}

module.exports = handler;
9 changes: 8 additions & 1 deletion src/server/views/dashboard/queueDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async function handler(req, res) {
hasFlows: Flows.hasFlows(),
});

let jobCounts, isPaused, globalConfig;
let jobCounts, hasRateLimitTtl, isPaused, globalConfig;
if (queue.IS_BEE) {
jobCounts = await queue.checkHealth();
delete jobCounts.newestJob;
Expand All @@ -31,6 +31,12 @@ async function handler(req, res) {
} else {
jobCounts = await queue.getJobCounts();
}

if (queue.IS_BULLMQ) {
const rateLimitTtl = await queue.getRateLimitTtl();
hasRateLimitTtl = rateLimitTtl > 0;
}

const stats = await QueueHelpers.getStats(queue);

if (!queue.IS_BEE) {
Expand All @@ -39,6 +45,7 @@ async function handler(req, res) {

return res.render('dashboard/templates/queueDetails', {
basePath,
hasRateLimitTtl,
isPaused,
queueName,
queueHost,
Expand Down
9 changes: 9 additions & 0 deletions src/server/views/dashboard/templates/queueDetails.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@
{{/if}}
{{/unless}}

{{#if queueIsBullMQ}}
{{#if hasRateLimitTtl}}
<button class="btn btn-xs btn-default js-remove-rate-limit-key" style="margin-bottom: 12px;" data-queue-host="{{ queueHost }}"
data-queue-name="{{ queueName }}">
Remove Rate Limit Key
</button>
{{/if}}
{{/if}}

<div class="row">
<div class="col-sm-6">
<div class="panel panel-default">
Expand Down