fix(memories): mark the Synology lookups and repair as independent writes for the transaction gate

Each photo's write follows its own network lookup, the repair's marker only
records that the pass ran, and a lookup may renew the Synology session on
its own; none of these can share one transaction.
This commit is contained in:
Maurice
2026-11-09 12:25:40 +01:00
parent c043ca4bba
commit a3c7c3d76a
2 changed files with 13 additions and 0 deletions
@@ -54,6 +54,8 @@ export class SynologyCaptureRepairJob implements OnApplicationBootstrap {
/**
* The pages after `after`, one after the other: each page's lookups run at
* once, held to a few per library by the backfill's slots.
*
* @txIndependent each photo's write follows its own lookup in the owner's library and stands on its own.
*/
private async walk(after: number): Promise<{ changed: number; failed: number }> {
const page = await this.trekPhotos.listByProviderAfter(PROVIDER, after, PAGE);
@@ -66,6 +68,11 @@ export class SynologyCaptureRepairJob implements OnApplicationBootstrap {
};
}
/**
* One pass, then the marker of how far it got.
*
* @txIndependent the marker follows a pass of network lookups and records only that the pass ran.
*/
async runOnce(): Promise<void> {
try {
if ((await this.settings.getAppSetting(SYNOLOGY_CAPTURE_REPAIR_DONE_KEY)) !== null) return;
@@ -724,6 +724,12 @@ export class SynologyService {
});
}
/**
* The photo's own details: the item of its unit, and the next item only when
* the library answered with another photo there (#3019).
*
* @txIndependent each lookup may renew the Synology session first; that write stands on its own.
*/
async getSynologyAssetInfo(
userId: number,
photoId: string,