chore: make a little more optimal

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2025-01-16 13:38:05 +01:00
parent 67bf279c8c
commit 3c51a16237
@@ -162,12 +162,6 @@ export class DefaultProviderDatabase implements ProviderDatabase {
logger: this.options.logger,
});
}
await tx<DbRefreshStateReferencesRow>('refresh_state_references')
.where('target_entity_ref', entityRef)
.andWhere({ source_key: options.sourceKey })
.delete();
if (ok) {
await tx<DbRefreshStateReferencesRow>('refresh_state_references')
.where('target_entity_ref', entityRef)
@@ -180,6 +174,11 @@ export class DefaultProviderDatabase implements ProviderDatabase {
target_entity_ref: entityRef,
});
} else {
await tx<DbRefreshStateReferencesRow>('refresh_state_references')
.where('target_entity_ref', entityRef)
.andWhere({ source_key: options.sourceKey })
.delete();
const conflictingKey = await checkLocationKeyConflict({
tx,
entityRef,