`pkgx --sync` on `main` never finishes if the pantry repo was not updated in the last 24 hours
I have a lot of pipelines stuck at pkgx install. After some troubleshooting, it seems that they aren't being able to sync the pantry.
Then I tried in my local machine and can reproduce it:
pkgx --sync
Never finishes, hangs forever.
The hanging issue during the pkgx --sync command could be due to network issues, server downtime, or local environment problems such as file system permissions. To diagnose the issue, you can enable logging to get more insights.
Here's an example of how you might add logging to the useSync function call:
export default async function({ flags, ...opts }: Args, logger_prefix?: string) {
const logger = make_logger(flags.verbosity, logger_prefix);
if (flags.sync) {
try {
logger.replace('Starting sync...');
await useSync();
logger.replace('Sync completed successfully.');
} catch (err) {
logger.replace(`Sync failed: ${err.message}`);
if (!flags.keepGoing) throw err;
}
}
// ... rest of the code
}
Additionally, you can manually check the status of the pantry server by using the ensure_pantry function:
async function ensure_pantry() {
if (usePantry().missing()) {
await useSync();
}
}
If the pantry is missing and the synchronization fails, it indicates that there might be an issue with the pantry server or related services [1].
If the problem persists, you might want to check the operational status of the external services zlib.net and python.org, as pkgx relies on these for syncing [2][3].
To continue talking to Dosu, mention @dosu.
lol. Found out the issue!
Since there was no change in the last 24 hours of pantry git, the following line always returns true, causing an infinite loop!
https://github.com/pkgxdev/libpkgx/blob/2aec73a0c16222d2c1a4eddb96acc867dddaa191/src/hooks/usePantry.ts#L267
- https://github.com/pkgxdev/libpkgx/pull/73
@jhheider I realized this issue only affects/affected the main branch of pkgx, and not the last released version 1.1.6.
I'm very sorry about it.
In fact, let me keep it open just as a reminder that this has to be fixed before releasing a new version from main.
That's great to know, and explains the lack of outrage. ;)
But it'll definitely need fixing.