From 424fd96615c05e949af8c837c261c1400bdffba2 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Mon, 9 Jun 2025 11:42:25 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E9=98=BF=E9=87=8C=E4=BA=91dns=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E5=A2=9E=E5=8A=A0=E9=87=8D=E8=AF=95=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dns-provider/aliyun-dns-provider.ts | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/packages/ui/certd-server/src/plugins/plugin-aliyun/dns-provider/aliyun-dns-provider.ts b/packages/ui/certd-server/src/plugins/plugin-aliyun/dns-provider/aliyun-dns-provider.ts index 8fbb27b9..cef9d1ba 100644 --- a/packages/ui/certd-server/src/plugins/plugin-aliyun/dns-provider/aliyun-dns-provider.ts +++ b/packages/ui/certd-server/src/plugins/plugin-aliyun/dns-provider/aliyun-dns-provider.ts @@ -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', }; - - const ret = await this.client.request('DeleteDomainRecord', params, requestOption); - this.logger.info('删除域名解析成功:', fullRecord, value, ret.RecordId); - return ret.RecordId; + 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 + } } }