Changed then to await.

This commit is contained in:
Jeffrey Phillips Freeman 2024-03-06 19:50:14 -05:00
parent 87a1458858
commit bb57253ff0
No known key found for this signature in database
GPG key ID: AD914585C9406B6A

View file

@ -42,10 +42,10 @@ export default async function (req: VercelRequest, res: VercelResponse) {
let sentIds = []; let sentIds = [];
if ( (!config.exists) || (configData == undefined) ) { if ( (!config.exists) || (configData == undefined) ) {
// Config doesn't exist, make something // Config doesn't exist, make something
configRef.set({ await configRef.set({
"sentIds": [], "sentIds": [],
"lastEpoch": "" "lastEpoch": ""
}).then(result => response.status(200)); });
} else { } else {
if( configData.sentIds.length > 0 ) { if( configData.sentIds.length > 0 ) {
sentIds.push(...configData.sentIds); sentIds.push(...configData.sentIds);
@ -59,10 +59,10 @@ export default async function (req: VercelRequest, res: VercelResponse) {
res.status(401).end("Function is rate limited, please wait") res.status(401).end("Function is rate limited, please wait")
return; return;
} else { } else {
configRef.set({ await configRef.set({
"sentIds": sentIds, "sentIds": sentIds,
"lastEpoch": new Date().getTime() "lastEpoch": new Date().getTime()
}).then(result => response.status(200)); });
} }
} }
@ -119,10 +119,10 @@ export default async function (req: VercelRequest, res: VercelResponse) {
if( sendingIds.size > 0 ) { if( sendingIds.size > 0 ) {
newSentIds.push(...sendingIds); newSentIds.push(...sendingIds);
} }
configRef.set({ await configRef.set({
"sentIds": newSentIds, "sentIds": newSentIds,
"lastEpoch": new Date().getTime() "lastEpoch": new Date().getTime()
}).then(result => response.status(200)); });
console.log("sendNode successful", sentIds, sendingIds, newSentIds); console.log("sendNode successful", sentIds, sendingIds, newSentIds);