Remove redundant entity existence check in performStitching
The initial SELECT entity_id FROM refresh_state check is redundant — the processedResult query in the Promise.all already handles the missing-entity case. This saves one database round trip per stitch. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -67,15 +67,6 @@ export async function performStitching(options: {
|
||||
let removeFromStitchQueueOnCompletion = true;
|
||||
|
||||
try {
|
||||
const entityResult = await knex<DbRefreshStateRow>('refresh_state')
|
||||
.where({ entity_ref: entityRef })
|
||||
.limit(1)
|
||||
.select('entity_id');
|
||||
if (!entityResult.length) {
|
||||
// Entity does no exist in refresh state table, no stitching required.
|
||||
return 'abandoned';
|
||||
}
|
||||
|
||||
// Selecting from refresh_state (with an optional left join to
|
||||
// final_entities for the previous hash) should yield exactly one row,
|
||||
// except in abnormal cases where the entity was deleted between the
|
||||
|
||||
Reference in New Issue
Block a user