Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
kravetsone committed Nov 13, 2024
2 parents 21f9610 + 9bac57f commit a49233e
Show file tree
Hide file tree
Showing 20 changed files with 341 additions and 454 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [v6.4.0](https://github.com/felixmosh/bull-board/compare/v6.3.3...v6.4.0)

- feat: paused jobs: support edit/duplicate/clean [`#846`](https://github.com/felixmosh/bull-board/pull/846)

#### [v6.3.3](https://github.com/felixmosh/bull-board/compare/v6.3.2...v6.3.3)

> 31 October 2024
- Release 6.3.3 [`38c79ee`](https://github.com/felixmosh/bull-board/commit/38c79ee63c0bd676cc42fcd067611420809916c4)
- fix: handle an error when highlighting an unmount component, occurs when navigating between tabs [`9add4ed`](https://github.com/felixmosh/bull-board/commit/9add4ed37d822c8e5bbf0973d553c2f4ed503910)
- fix: failed status should show Error tab at start [`7cad06e`](https://github.com/felixmosh/bull-board/commit/7cad06e73a2a79c8c19206c79810eb623e47ca82)

Expand Down
11 changes: 11 additions & 0 deletions docker-compose.redis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
services:
redis:
image: redis:latest
hostname: redis
restart: unless-stopped
ports:
- 6379:6379
volumes:
- redis_data:/data
volumes:
redis_data:
83 changes: 42 additions & 41 deletions examples/with-elysia/index.ts
Original file line number Diff line number Diff line change
@@ -1,64 +1,65 @@
import { createBullBoard } from "@bull-board/api";
import { BullMQAdapter } from "@bull-board/api/bullMQAdapter";
import { ElysiaAdapter } from "@bull-board/elysia";
import { Queue as QueueMQ, Worker } from "bullmq";
import Elysia from "elysia";
import { createBullBoard } from '@bull-board/api';
import { BullMQAdapter } from '@bull-board/api/bullMQAdapter';
import { ElysiaAdapter } from '@bull-board/elysia';
import { Queue as QueueMQ, Worker } from 'bullmq';
import Elysia from 'elysia';

const sleep = (t: number) =>
new Promise((resolve) => setTimeout(resolve, t * 1000));
const sleep = (t: number) => new Promise((resolve) => setTimeout(resolve, t * 1000));

const redisOptions = {
port: 6379,
host: "localhost",
password: "",
port: 6379,
host: 'localhost',
password: '',
};

const createQueueMQ = (name: string) =>
new QueueMQ(name, { connection: redisOptions });
const createQueueMQ = (name: string) => new QueueMQ(name, { connection: redisOptions });

async function setupBullMQProcessor(queueName: string) {
new Worker(
queueName,
async (job) => {
for (let i = 0; i <= 100; i++) {
await sleep(Math.random());
await job.updateProgress(i);
await job.log(`Processing job at interval ${i}`);
new Worker(
queueName,
async (job) => {
for (let i = 0; i <= 100; i++) {
await sleep(Math.random());
await job.updateProgress(i);
await job.log(`Processing job at interval ${i}`);

if (Math.random() * 200 < 1) throw new Error(`Random error ${i}`);
}
if (Math.random() * 200 < 1) throw new Error(`Random error ${i}`);
}

return { jobId: `This is the return value of job (${job.id})` };
},
{ connection: redisOptions },
);
return { jobId: `This is the return value of job (${job.id})` };
},
{ connection: redisOptions }
);
}

const exampleBullMq = createQueueMQ("BullMQ");
const exampleBullMq = createQueueMQ('BullMQ');

await setupBullMQProcessor(exampleBullMq.name);

const serverAdapter = new ElysiaAdapter("/ui");
const serverAdapter = new ElysiaAdapter('/ui');

createBullBoard({
queues: [new BullMQAdapter(exampleBullMq)],
serverAdapter,
queues: [new BullMQAdapter(exampleBullMq)],
serverAdapter,
});

const app = new Elysia()
.use(serverAdapter.registerPlugin())
.get("/add", async ({ query }) => {
await exampleBullMq.add("Add", { title: query.title });
.onError(({ error, code, request }) => {
console.error(error, code, request.method, request.url);
})
.use(serverAdapter.registerPlugin())
.get('/add', async ({ query }) => {
await exampleBullMq.add('Add', { title: query.title });

return { ok: true };
});
return { ok: true };
});

app.listen(3000, ({ port, url }) => {
/* eslint-disable no-console */
console.log(`Running on ${url.hostname}:${port}...`);
console.log(`For the UI of instance1, open http://localhost:${port}/ui`);
console.log("Make sure Redis is running on port 6379 by default");
console.log("To populate the queue, run:");
console.log(` curl http://localhost:${port}/add?title=Example`);
/* eslint-enable no-console */
/* eslint-disable no-console */
console.log(`Running on ${url.hostname}:${port}...`);
console.log(`For the UI of instance1, open http://localhost:${port}/ui`);
console.log('Make sure Redis is running on port 6379 by default');
console.log('To populate the queue, run:');
console.log(` curl http://localhost:${port}/add?title=Example`);
/* eslint-enable no-console */
});
6 changes: 3 additions & 3 deletions examples/with-elysia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"description": "Example of how to use Elysia server with bull-board",
"module": "index.ts",
"scripts": {
"start": "bun index.ts",
"dev": "bun --watch index.ts",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "kravetsone",
"license": "ISC",
"dependencies": {
"@bull-board/elysia": "^5.20.1",
"bullmq": "^4.6.0",
"elysia": "^1.0.22"
"bullmq": "4.8.0",
"elysia": "^1.1.24"
}
}
25 changes: 13 additions & 12 deletions examples/with-elysia/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"compilerOptions": {
"lib": ["ESNext"],
"module": "ESNext",
"target": "ESNext",
"moduleResolution": "Bundler",
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
"rootDir": "./src",
"noEmit": true
},
"include": ["src"]
"lib": ["ESNext", "DOM"],
"module": "ESNext",
"target": "ESNext",
"moduleResolution": "Bundler",
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
"noUncheckedIndexedAccess": true,
"verbatimModuleSyntax": true,
"rootDir": "./src",
"noEmit": true
}
}
Loading

0 comments on commit a49233e

Please sign in to comment.