Commit 84124d83 authored by oyhk's avatar oyhk
Browse files

[fix]

parent d0ed851e
Showing with 12 additions and 1 deletion
+12 -1
......@@ -115,6 +115,12 @@ export class PluginNacosService {
return result;
}
/**
* 修改实例上下线
* @param dto
* @param pluginEurekaConfig
* @return ok
*/
async instanceChangeStatus(dto: PluginNacosServiceInstanceDto, pluginEurekaConfig: PluginNacosConfig) {
const url = `${pluginEurekaConfig.nacosUrl}/nacos/v1/ns/instance`;
const result = await this.httpService.put(url, qs.stringify({
......
......@@ -490,7 +490,7 @@ export class ProjectService {
*/
async projectAppChangeStatusInNacos(dto: PluginNacosServiceInstanceDto, pluginNacosConfig: PluginRegisterCenterConfig) {
console.log(`项目:${dto.serviceName} 在 Nacos 注册中心 ${dto.ip}${dto.enabled} 开始`);
let filterInstance ={} as PluginNacosServiceInstanceDto;
let filterInstance = {} as PluginNacosServiceInstanceDto;
while (true) {
const instanceList: PluginNacosServiceInstanceDto[] = await this.pluginNacosService.instanceList(dto, pluginNacosConfig);
if (!instanceList) {
......@@ -504,6 +504,11 @@ export class ProjectService {
break;
}
// 修改上下线完成结束
if (filterInstance.enabled === dto.enabled) {
break;
}
filterInstance.enabled = dto.enabled;
await this.pluginNacosService.instanceChangeStatus(filterInstance, pluginNacosConfig);
console.log(`项目:${dto.serviceName} 在 Nacos 注册中心 ${dto.ip}${dto.enabled} 中...`);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment