setup memory bank
This commit is contained in:
@ -68,6 +68,7 @@ async function processVideo(server: any, video: VideoRecord) {
|
||||
await sleep(60000);
|
||||
} else {
|
||||
logger.error(`All retries failed for video ${video.id} on server ${server.baseUrl}.`);
|
||||
await query("UPDATE video SET video_path = '' WHERE id = ?", [video.id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -75,8 +76,14 @@ async function processVideo(server: any, video: VideoRecord) {
|
||||
|
||||
async function worker(server: any) {
|
||||
while (true) {
|
||||
await sleep(Math.random() * 3000); // Random delay
|
||||
const videosToProcess = (await query(
|
||||
"SELECT * FROM video WHERE video_prompt IS NOT NULL AND image_path IS NOT NULL AND image_path != 'processing' AND (video_path IS NULL OR video_path = '') LIMIT 1"
|
||||
`SELECT * FROM video
|
||||
WHERE video_prompt IS NOT NULL
|
||||
AND image_path IS NOT NULL
|
||||
AND image_path != 'processing'
|
||||
AND (video_path IS NULL OR video_path = '')
|
||||
ORDER BY RAND() LIMIT 1`
|
||||
)) as VideoRecord[];
|
||||
|
||||
if (videosToProcess.length === 0) {
|
||||
@ -97,7 +104,7 @@ async function main() {
|
||||
try {
|
||||
const promises = servers.map(server => {
|
||||
if (!server.baseUrl || !server.outputDir) {
|
||||
logger.warn(`Server is not configured. Skipping.`);
|
||||
logger.warn(`Server is not configured.Skipping.`);
|
||||
return Promise.resolve();
|
||||
}
|
||||
return worker(server);
|
||||
|
||||
Reference in New Issue
Block a user