import { getRedisInstance } from "./index";

export const APK_BUILD_QUEUE_CHANNEL = "queue:apk-build";

export async function publishApkBuildSignal(payload: {
    taskId: string;
    buildId: string;
}) {
    const redis = getRedisInstance();
    await redis.connect().catch(() => undefined);
    await redis.publish(APK_BUILD_QUEUE_CHANNEL, JSON.stringify(payload));
}

export function getApkBuildSubscriber() {
    const subscriber = getRedisInstance().duplicate();
    return subscriber;
}
