Skip to content

Commit c3a3f3c

Browse files
updated the docker image new version
1 parent fc5f455 commit c3a3f3c

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

worker-image/workers/index.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,26 +170,33 @@ async function processJob(ques_name, code, language, testcases) {
170170
)
171171
);
172172
console.log(results, "this is results");
173-
// Store job result
173+
174+
// ✅ Added log before pushing result to Redis
175+
console.log(`[Redis Push] 🟢 Storing job:${ques_name}:result`);
176+
174177
await redis_server.setEx(
175178
`job:${ques_name}:result`,
176179
300,
177180
JSON.stringify(results)
178181
);
179-
await redis_server.hSet(`job:${ques_name}:status`, {
180-
state: "completed",
181-
});
182+
console.log(`[Redis Push] ✅ Result stored successfully`);
183+
184+
console.log(`[Redis Push] 🟢 Updating job:${ques_name}:status -> completed`);
185+
await redis_server.hSet(`job:${ques_name}:status`, { state: "completed" });
182186
await redis_server.expire(`job:${ques_name}:status`, 300);
187+
console.log(`[Redis Push] ✅ Status updated successfully`);
188+
183189
} catch (err) {
184190
console.error("Error during job processing:", err);
191+
192+
console.log(`[Redis Push] 🔴 Storing failed state for job:${ques_name}`);
185193
await redis_server.setEx(
186194
`job:${ques_name}:result`,
187195
30,
188196
JSON.stringify([{ error: err.toString() }])
189197
);
190-
await redis_server.hSet(`job:${ques_name}:status`, {
191-
state: "failed",
192-
});
198+
await redis_server.hSet(`job:${ques_name}:status`, { state: "failed" });
199+
console.log(`[Redis Push] ❌ Failure recorded in Redis`);
193200
} finally {
194201
try {
195202
fs.unlinkSync(filePath);

0 commit comments

Comments
 (0)