fix(backend): 処理に失敗するとidempotentキーを削除してしまいその後のリクエストが通ってしまう問題を修正 (MisskeyIO#591)

This commit is contained in:
まっちゃとーにゅ 2024-04-01 18:44:44 +09:00 committed by GitHub
parent 92bdc2e054
commit 31ebd77e8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 79 additions and 8 deletions

View file

@ -445,8 +445,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
createdNote: await this.noteEntityService.pack(note, me),
};
} catch (err) {
// エラーが発生した場合、リクエストの処理結果を削除
await this.redisForTimelines.unlink(`note:idempotent:${me.id}:${hash}`);
// エラーが発生した場合、まだ処理中として記録されている場合はリクエストの処理結果を削除
await this.redisForTimelines.unlinkIf(`note:idempotent:${me.id}:${hash}`, '_');
logger.error('Failed to create a note.', { error: err });