This PR attempts to resolve #67, #79, and a few other small issues with GitUtil like it panicking if the manifest.json gets deleted.
Main Changes:
Turned the "delete local repo and clone" code into it's own function deleteAndPull.
Calculates the number of seconds since last update, only updating a repo every two minutes.
The if (git.sha) code is now inside of the Try block so that errors from git pull/git checkout will both be caught by the catch block (which calls deleteAndPull).
At the end of end of refreshGit we now update the database entry's updatedAt field to the current time (used for determining if the repo needs to be updated when new jobs are submitted).
In getExecutableManifest rather than simply throwing an error if the manifest can't be read, we call deleteAndPull to delete the repo, clone it again, and then read the manifest.
I believe including the if (git.sha) code in the Try block will solve #67 and #79 will hopefully be solved by the "how long since updated" check, but we are waiting to hear back from the person who reported the bug to do extensive testing.
This PR attempts to resolve #67, #79, and a few other small issues with GitUtil like it panicking if the manifest.json gets deleted.
Main Changes:
deleteAndPull
.if (git.sha)
code is now inside of the Try block so that errors fromgit pull
/git checkout
will both be caught by the catch block (which callsdeleteAndPull
).refreshGit
we now update the database entry'supdatedAt
field to the current time (used for determining if the repo needs to be updated when new jobs are submitted).getExecutableManifest
rather than simply throwing an error if the manifest can't be read, we calldeleteAndPull
to delete the repo, clone it again, and then read the manifest.I believe including the
if (git.sha)
code in the Try block will solve #67 and #79 will hopefully be solved by the "how long since updated" check, but we are waiting to hear back from the person who reported the bug to do extensive testing.