Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Gigs optimize part 2 #154

Merged
merged 3 commits into from
Jul 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/actions/myGigs.js
Original file line number Diff line number Diff line change
@@ -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";

/**
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions src/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;