Manager: speed up job deletion by skipping the DB integrity check

Speed up the deletion of multiple jobs by skipping the database integrity
check. It is now clear what was causing the integrity issues (disabled
foreign key constraints), and this is now checked for before deleting
anything. This reduces the deletion time from ~500ms per job to ~150ms
(on my computer, with my database, of course).
This commit is contained in:
Sybren A. Stüvel 2024-05-28 14:23:13 +02:00
parent 390cb9445c
commit 286d0efa2d
2 changed files with 0 additions and 6 deletions

@ -231,10 +231,6 @@ func (s *Service) deleteJob(ctx context.Context, jobUUID string) error {
Stringer("duration", duration).
Msg("job deleter: job removal complete")
// Request a consistency check on the database. In the past there have been
// some issues after deleting a job.
s.persist.RequestIntegrityCheck()
return nil
}

@ -110,7 +110,6 @@ func TestDeleteJobWithoutShaman(t *testing.T) {
// Mock that everything went OK.
mocks.storage.EXPECT().RemoveJobStorage(mocks.ctx, jobUUID)
mocks.persist.EXPECT().DeleteJob(mocks.ctx, jobUUID)
mocks.persist.EXPECT().RequestIntegrityCheck()
mocks.broadcaster.EXPECT().BroadcastJobUpdate(gomock.Any())
require.NoError(t, s.deleteJob(mocks.ctx, jobUUID))
}
@ -155,7 +154,6 @@ func TestDeleteJobWithShaman(t *testing.T) {
mocks.shaman.EXPECT().EraseCheckout(shamanCheckoutID)
mocks.storage.EXPECT().RemoveJobStorage(mocks.ctx, jobUUID)
mocks.persist.EXPECT().DeleteJob(mocks.ctx, jobUUID)
mocks.persist.EXPECT().RequestIntegrityCheck()
mocks.broadcaster.EXPECT().BroadcastJobUpdate(gomock.Any())
require.NoError(t, s.deleteJob(mocks.ctx, jobUUID))
}