enhance: ActivityPub 周りで 429 を受け取った際にリトライするように (MisskeyIO#324)
This commit is contained in:
parent
f1b7f3425e
commit
397e056b1e
6 changed files with 8 additions and 6 deletions
|
|
@ -7,6 +7,7 @@ export class StatusError extends Error {
|
|||
public statusCode: number;
|
||||
public statusMessage?: string;
|
||||
public isClientError: boolean;
|
||||
public isRetryable: boolean;
|
||||
|
||||
constructor(message: string, statusCode: number, statusMessage?: string) {
|
||||
super(message);
|
||||
|
|
@ -14,5 +15,6 @@ export class StatusError extends Error {
|
|||
this.statusCode = statusCode;
|
||||
this.statusMessage = statusMessage;
|
||||
this.isClientError = typeof this.statusCode === 'number' && this.statusCode >= 400 && this.statusCode < 500;
|
||||
this.isRetryable = !this.isClientError || this.statusCode === 429;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue