Skip to content

Commit 579e739

Browse files
committed
Replace LockService-based setTimeout with Utilities.sleep in Google Script
1 parent 8926dff commit 579e739

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

services/google-script/index.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -562,21 +562,15 @@ class Game {
562562
}
563563

564564
delay (ms) {
565-
return new Promise(resolve => {
566-
setTimeout(() => {
567-
resolve();
568-
}, ms);
569-
});
565+
Utilities.sleep(ms);
570566
}
571567
}
572568

573569
function setTimeout (func, timeout) {
574-
const lock = LockService.getScriptLock();
575-
lock.waitLock(timeout);
576-
570+
if (timeout && timeout > 0) {
571+
Utilities.sleep(timeout);
572+
}
577573
func();
578-
579-
lock.releaseLock();
580574
}
581575

582576
function checkInGame (gameName) {

0 commit comments

Comments
 (0)