Skip to content

Commit 97a4ab1

Browse files
committed
fix: time interval
1 parent a2da2f5 commit 97a4ab1

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

dist/index.js

Lines changed: 8 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,21 @@ async function run() {
1515
const SyncModel = mongoose.model('sync', Sync);
1616
let found = undefined
1717

18-
const intervalId = setInterval(async () => {
18+
const wait = async () => {
1919
found = await SyncModel.findOne({})
2020
if (found.count == 0) {
21-
clearInterval(intervalId)
2221
found = await SyncModel.findOneAndUpdate({}, {count: found.count + 1}, {new: true})
2322
await standardVersion(getConfiguration());
2423
await SyncModel.findOneAndUpdate({}, {count: found.count - 1}, {new: true})
2524
mongoose.disconnect()
25+
} else {
26+
setTimeout(() => {
27+
wait()
28+
}, 1000);
2629
}
27-
}, 1000);
30+
}
31+
32+
wait()
2833
} catch (error) {
2934
core.setFailed(error.stack);
3035
}

0 commit comments

Comments
 (0)