Await DB write and add UID cache key
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
Notify HeyPuter / notify (push) Has been cancelled
release-please / release-please (push) Has been cancelled
test / test-backend (24.x) (push) Has been cancelled
test / API tests (node env, api-test) (24.x) (push) Has been cancelled
test / puterjs (node env, vitest) (24.x) (push) Has been cancelled

Make the DB update in AppES awaitable so the write completes before proceeding (avoids race conditions). Also add invalidation of the Redis object key for the app UID in AppInformationService to ensure cached entries keyed by uid are cleared after updates.
This commit is contained in:
jelveh
2026-04-21 19:32:19 -07:00
parent bdfa12b566
commit b886dde3d6
2 changed files with 5 additions and 1 deletions
@@ -123,6 +123,10 @@ class AppInformationService extends BaseService {
value: appUid,
rawIcon: false,
}),
AppRedisCacheSpace.objectKey({
lookup: 'uid',
value: appUid,
}),
]),
AppRedisCacheSpace.invalidateAppStats(appUid),
]);
+1 -1
View File
@@ -300,7 +300,7 @@ class AppES extends BaseES {
};
await svc_event.emit('app.new-icon', event);
if ( typeof event.url === 'string' && event.url ) {
this.db.write(
await this.db.write(
'UPDATE apps SET icon = ? WHERE id = ? LIMIT 1',
[event.url, insert_id],
);