Skip to content

Keep the server running when the federation registry scan fails - #201

Open
NetworkTheoryAppliedResearchInstitute wants to merge 1 commit into
mainfrom
fix/sync-scan-failure
Open

NetworkTheoryAppliedResearchInstitute wants to merge 1 commit into
mainfrom
fix/sync-scan-failure

Conversation

@NetworkTheoryAppliedResearchInstitute

Copy link
Copy Markdown
Collaborator

What

runFederationSync in federation/federationSyncJob.js now catches a failed NodeRegistry scan, logs one line of text, and returns. Neither the startup run in server.js nor the six-hour interval can stop the process; the next run scans again. A scan with no Items counts as empty. sync/scheduler.js already contained this failure and is unchanged.

This does not change what federation imports or exports, or whether sync is scheduled.

Tests

  • Scheduled callback: a rejected scan resolves and logs once; after six fake-clock hours the timer syncs the healthy peer while another fails.
  • Startup run: a rejected scan resolves.
  • No Items: the run resolves.
  • sync/scheduler.js: the same check, as a guard.

The first three fail without the fix. Full suite: node:test 61/61, Jest 50/50.

Shares federation/federationSyncJob.js and its test with #194 and #197, and sync/__tests__/scheduler.test.js with #194.

🤖 Generated with Claude Code

runFederationSync now catches a failed NodeRegistry scan, logs one
line with the error message, and returns. Neither the first run that
server.js starts nor the six-hour interval can reject unhandled and
stop the process, and the next scheduled run scans again. Per-peer
failures were already isolated and are unchanged. A missing Items
field now counts as an empty registry.

Tests: the federation sync job test calls the scheduled callback with
a rejected scan and checks that it resolves and logs once as text,
then advances the fake clock six hours and checks that the timer's
next run syncs a healthy peer while another peer fails. Further tests
cover a rejected scan on the first run started by the server and a
scan with no Items. A scheduler test pins the same behaviour for
sync/scheduler.js, which already contained the failure.

Signed-off-by: Jodson Graves <info@ntari.org>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
promise: () => Promise.resolve({ Items: [{ url: 'http://down.example' }, { url: 'http://up.example' }] })
});
dynamodbClient.update.mockReturnValue({ promise: () => Promise.resolve() });
axios.get.mockImplementation((url) => (url.startsWith('http://down.example')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants