From 88085fd59c277e9c3c59fb85f7b1b5517c255d9e Mon Sep 17 00:00:00 2001
From: tamaina <tamaina@hotmail.co.jp>
Date: Sun, 21 Jul 2024 02:51:17 +0900
Subject: [PATCH] =?UTF-8?q?deliver=E3=81=A7inbox=E3=81=AB=E6=8A=95?=
 =?UTF-8?q?=E3=81=92=E3=81=A6401=E3=81=8C=E8=BF=94=E3=81=A3=E3=81=A6?=
 =?UTF-8?q?=E3=81=8D=E3=81=9F=E5=A0=B4=E5=90=88=E3=80=81=E6=99=82=E8=A8=88?=
 =?UTF-8?q?=E3=81=8C=E7=8B=82=E3=81=A3=E3=81=A6=E3=81=84=E3=82=8B=E5=A0=B4?=
 =?UTF-8?q?=E5=90=88=E3=81=8C=E3=81=82=E3=82=8B=E3=81=9F=E3=82=81=E3=83=AA?=
 =?UTF-8?q?=E3=83=88=E3=83=A9=E3=82=A4=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88?=
 =?UTF-8?q?=E3=81=86=E3=81=AB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../backend/src/queue/processors/DeliverProcessorService.ts  | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/packages/backend/src/queue/processors/DeliverProcessorService.ts b/packages/backend/src/queue/processors/DeliverProcessorService.ts
index 3bd9187e8b..2ca1e5497c 100644
--- a/packages/backend/src/queue/processors/DeliverProcessorService.ts
+++ b/packages/backend/src/queue/processors/DeliverProcessorService.ts
@@ -134,6 +134,11 @@ export class DeliverProcessorService {
 			});
 
 			if (res instanceof StatusError) {
+				if (res.statusCode === 401) {
+					// 401 Unauthorized: this may be caused by a time difference between the server and the target server.
+					// Let the job be retried.
+					throw new Error(`${res.statusCode} ${res.statusMessage}\n* 401 may be caused by a time difference between the server and the target server.`);
+				}
 				// 4xx
 				if (!res.isRetryable) {
 					// 相手が閉鎖していることを明示しているため、配送停止する