Skip to content

Commit

Permalink
fix(file-cache): retry error files queue update
Browse files Browse the repository at this point in the history
  • Loading branch information
nagyszabi authored and burgerni10 committed Jul 18, 2023
1 parent cbb95a0 commit 5558306
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions backend/src/service/cache/file-cache.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ describe('FileCache', () => {
path.resolve('myCacheFolder', 'files-errors', filenames[2]),
path.resolve('myCacheFolder', 'files', filenames[2])
);

// Check if the files have been added back to the queue
const queueFiles = filenames.map(name => path.resolve('myCacheFolder', 'files', name));
expect(cache['filesQueue']).toEqual(queueFiles);
});

it('should remove all error files when the error folder is not empty', async () => {
Expand Down
5 changes: 5 additions & 0 deletions backend/src/service/cache/file-cache.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ export default class FileCacheService {
const cacheFilePath = path.join(this._fileFolder, filename);
this._logger.debug(`Moving error file "${errorFilePath}" back to cache "${cacheFilePath}"`);
await fs.rename(errorFilePath, cacheFilePath);
// Add the file to the queue once it is persisted in the cache folder
this.filesQueue.push(cacheFilePath);
if (this._settings.sendFileImmediately) {
this.triggerRun.emit('next');
}
})
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ <h1>
</div>
</div>
</div>
<oib-error-files [northConnector]="northConnector"></oib-error-files>
<oib-error-files *ngIf="northConnector" [northConnector]="northConnector"></oib-error-files>

0 comments on commit 5558306

Please sign in to comment.