Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/ai-music-system / worker.js |
| Date | Not specified in source |
| Repository | Janady13/ai-music-system |
| Revision | 9a816470ef81edba7a5d8f3aae62c05eead638a7 |
| Branch | main |
| Path or archive member | worker.js |
| Original SHA-256 | 7da0aae88187bd7cbd0bfa1a95bb2070d996972440e5f7f8b1da6f8a1d201663 |
| Git blob SHA | 9e6a83aa0b08ffe92db54e013626a2032a8149ac |
| Reading-copy SHA-256 | 7da0aae88187bd7cbd0bfa1a95bb2070d996972440e5f7f8b1da6f8a1d201663 |
Every recorded occurrence
These 3 records contain identical original source bytes. Their paths and revisions remain part of the archive.
| Original record | Branch or archive | Revision / identifier | Original location |
|---|---|---|---|
| Janady13/ai-music-system / worker.js | main | 9a816470ef81edba7a5d8f3aae62c05eead638a7 | Open original |
| Janady13/ai-music-system / worker.js | codex/create-ai-for-music-generation-ifwcfc | cd5207850253ee238f8a267c043b1e3c070ed81a | Open original |
| Janady13/ai-music-system / worker.js | codex/create-ai-for-music-generation | 017052c0e72c6175378aebb7a7f9dd96e82c3ce2 | Open original |
Recovered source transcript
Download complete source text ↓44 lines · 1.2 KB
const { Worker, QueueScheduler, Queue } = require("bullmq");
const pino = require("pino");
const { makeRedis } = require("./lib/redis");
const path = require("path");
const fs = require("fs");
const log = pino();
const connection = makeRedis();
const plugins = new Map();
const pluginDir = path.join(__dirname, "plugins");
for (const f of fs.readdirSync(pluginDir)) {
if (f.endsWith(".js")) {
const p = require(path.join(pluginDir, f));
plugins.set(p.name, p);
log.info({ plugin: p.name }, "loaded plugin");
}
}
new QueueScheduler("skynet", { connection });
const queue = new Queue("skynet", { connection });
const worker = new Worker("skynet", async job => {
const plugin = plugins.get(job.name);
if (!plugin) {
log.warn({ job: job.name }, "no plugin found");
return;
}
await plugin.process(job, log);
}, { connection, concurrency: 4 });
worker.on("failed", e => log.error({ err: e.message, jobId: e?.job?.id }, "job failed"));
worker.on("error", e => log.error({ err: e.message }, "worker error"));
// lightweight redis self heal loop
setInterval(async () => {
try {
await connection.ping();
} catch {
log.warn("redis ping failed trying to reconnect");
try { connection.disconnect(); } catch {}
}
}, 10_000);