cronjob admin token

This commit is contained in:
AdisakKanthawilang 2024-12-18 10:59:57 +07:00
parent 4077900079
commit 42c9c8a8f5
4 changed files with 36 additions and 28 deletions

View file

@ -62,7 +62,7 @@ function createConsumer( //----> consumer
console.log("[AMQ] Process Consumer success");
return channel.ack(msg);
}
console.log("[AMQ] Process Consumer fail");
console.log("[AMQ] Process Consumer failed");
return await new Promise((resolve) => setTimeout(() => resolve(channel.nack(msg)), 3000));
},
{ noAck: false },
@ -82,9 +82,10 @@ async function handler(msg: amqp.ConsumeMessage): Promise<boolean> {
const path = commandTypePath(command.commandType.code);
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
return await new CallAPI()
.PostData(
{
headers: { authorization: token }, //time bomb
headers: { authorization: token },
},
path + "/excecute",
{