Skip to content

Commit

Permalink
fix recursive return (#660)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesPHoughton authored Oct 19, 2023
1 parent c639866 commit 2dba27e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/06_Many_Games.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe("Many Games", { retries: { runMode: 2, openMode: 0 } }, () => {
const valueCounts = (a) =>
new Map([...new Set(a)].map((x) => [x, a.filter((y) => y === x).length]));

// check that player 1's data is exported even though player 2 is not finished
// check that each room has two players assigned to it, as expected
cy.get("@dataObjects").then((dataObjects) => {
const recordingsFolders = dataObjects.map((obj) => obj.recordingsFolder);
const counts = valueCounts(recordingsFolders);
Expand Down
12 changes: 7 additions & 5 deletions server/src/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export async function commitFile({
directory,
filepath,
throwErrors, // if true, raises errors on commit failure
retries = 3,
retries = 0,
}) {
const filename = path.basename(filepath);

Expand Down Expand Up @@ -109,7 +109,7 @@ export async function commitFile({
return true;
} catch (e) {
if (e.status === 409) {
log(
warn(
`Conflict committing file ${filename} to repository ${owner}/${repo}/${branch}/${directory}, likely out-of-date sha`
);
} else {
Expand All @@ -122,8 +122,8 @@ export async function commitFile({
if (throwErrors) throw e;

if (retries > 0) {
log(`Retrying commit of ${filename} (${retries} tries left))`);
await commitFile({
info(`Retrying commit of ${filename} (${retries} tries left))`);
const success = await commitFile({
owner,
repo,
branch,
Expand All @@ -132,13 +132,13 @@ export async function commitFile({
throwErrors, // if true, raises errors on commit failure
retries: retries - 1,
});
return success;
}

error(
`Failed to commit ${filename} to ${owner}/${repo}/${branch}/${directory}. No retries left.`,
e
);

return false;
}
}
Expand Down Expand Up @@ -173,6 +173,7 @@ export async function pushPreregToGithub({ batch, delaySeconds = 60 }) {
branch,
directory,
filepath: preregistrationDataFilename,
retries: 3,
});
});
// Todo: Add treatment description file push to private repo
Expand Down Expand Up @@ -218,6 +219,7 @@ export async function pushDataToGithub({
directory,
filepath: scienceDataFilename,
throwErrors,
retries: 3,
});
})
);
Expand Down

0 comments on commit 2dba27e

Please sign in to comment.