diff --git a/src/actions/myGigs.js b/src/actions/myGigs.js index f992aef..03aaab4 100644 --- a/src/actions/myGigs.js +++ b/src/actions/myGigs.js @@ -1,5 +1,9 @@ import { createActions } from "redux-actions"; -import { PER_PAGE, CHECKING_GIG_TIMES } from "../constants"; +import { + PER_PAGE, + CHECKING_GIG_TIMES, + DELAY_CHECK_GIG_TIME, +} from "../constants"; import service from "../services/myGigs"; /** @@ -35,6 +39,11 @@ async function startCheckingGigs(externalId) { while (i < CHECKING_GIG_TIMES) { const res = await service.startCheckingGigs(externalId); if (res && !res.synced) { + await new Promise((resolve) => { + setTimeout(() => { + resolve(); + }, DELAY_CHECK_GIG_TIME); + }); i++; continue; } else { diff --git a/src/constants/index.js b/src/constants/index.js index cdaed29..a250274 100644 --- a/src/constants/index.js +++ b/src/constants/index.js @@ -354,3 +354,5 @@ export const EMPTY_GIGS_TEXT = "LOOKS LIKE YOU HAVEN'T APPLIED TO ANY GIG OPPORTUNITIES YET."; export const CHECKING_GIG_TIMES = 3; + +export const DELAY_CHECK_GIG_TIME = 2000;