if we run on pixmap.fun, wipe redis

This commit is contained in:
HF 2024-05-17 22:39:01 +02:00
parent b75e6906ae
commit d7d0cfc846
Signed by: hf
GPG Key ID: E7ABBB827162F9CC

View File

@ -7,7 +7,7 @@ import path from 'path';
import { createClient, defineScript } from 'redis';
import { isMainThread } from 'worker_threads';
import { REDIS_URL, SHARD_NAME } from '../../core/config';
import { REDIS_URL, SHARD_NAME, BACKUP_URL } from '../../core/config';
const scripts = {
placePxl: defineScript({
@ -83,6 +83,9 @@ export const connect = async () => {
pubsub.publisher = client;
pubsub.subscriber = subscriber;
}
if (BACKUP_URL?.includes('pixmap.fun')) {
client.flushAll('ASYNC');
}
};
export default client;