mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-18 17:51:24 +00:00

* perf: introduce BullMQ for website sync (#4403) * perf: introduce BullMQ for website sync * feat: new redis module * fix: remove graceful shutdown * perf: improve UI in dataset detail - Updated the "change" icon SVG file. - Modified i18n strings. - Added new i18n string "immediate_sync". - Improved UI in dataset detail page, including button icons and background colors. * refactor: Add chunkSettings to DatasetSchema * perf: website sync ux * env template * fix: clean up website dataset when updating chunk settings (#4420) * perf: check setting updated * perf: worker currency * feat: init script for website sync refactor (#4425) * website feature doc --------- Co-authored-by: a.e. <49438478+I-Info@users.noreply.github.com>
28 lines
666 B
TypeScript
28 lines
666 B
TypeScript
import Redis from 'ioredis';
|
|
|
|
const REDIS_URL = process.env.REDIS_URL ?? 'redis://localhost:6379';
|
|
|
|
export function newQueueRedisConnection() {
|
|
const redis = new Redis(REDIS_URL);
|
|
redis.on('connect', () => {
|
|
console.log('Redis connected');
|
|
});
|
|
redis.on('error', (error) => {
|
|
console.error('Redis connection error', error);
|
|
});
|
|
return redis;
|
|
}
|
|
|
|
export function newWorkerRedisConnection() {
|
|
const redis = new Redis(REDIS_URL, {
|
|
maxRetriesPerRequest: null
|
|
});
|
|
redis.on('connect', () => {
|
|
console.log('Redis connected');
|
|
});
|
|
redis.on('error', (error) => {
|
|
console.error('Redis connection error', error);
|
|
});
|
|
return redis;
|
|
}
|