perf: 阿里云dns操作增加重试机制

pull/436/head
xiaojunnuo 2025-06-09 11:42:25 +08:00
parent ebfcea88da
commit 424fd96615
1 changed files with 17 additions and 4 deletions

View File

@ -109,6 +109,11 @@ export class AliyunDnsProvider extends AbstractDnsProvider {
if (e.code === 'DomainRecordDuplicate') {
return;
}
if(e.code === "LastOperationNotFinished"){
this.logger.info('上一个操作还未完成5s后重试')
await this.ctx.utils.sleep(5000)
return this.createRecord(options)
}
this.logger.info('添加域名解析出错', e);
this.resolveError(e, options);
}
@ -131,10 +136,18 @@ export class AliyunDnsProvider extends AbstractDnsProvider {
const requestOption = {
method: 'POST',
};
try{
const ret = await this.client.request('DeleteDomainRecord', params, requestOption);
this.logger.info('删除域名解析成功:', fullRecord, value, ret.RecordId);
return ret.RecordId;
}catch (e) {
if(e.code === "LastOperationNotFinished"){
this.logger.info('上一个操作还未完成5s后重试')
await this.ctx.utils.sleep(5000)
return this.removeRecord(options)
}
throw e
}
}
}