【issues/5115】因swagger文档导致gateway内存溢出

pull/5177/head
zhangdaiscott 2023-07-17 16:11:04 +08:00
parent 6134db4984
commit 5273b81f94
1 changed files with 9 additions and 2 deletions

View File

@ -35,6 +35,10 @@ public class MySwaggerResourceProvider implements SwaggerResourcesProvider {
* *
*/ */
private final RouteLocator routeLocator; private final RouteLocator routeLocator;
/**
* Nacos
*/
private NamingService naming;
/** /**
* nacos * nacos
@ -115,9 +119,12 @@ public class MySwaggerResourceProvider implements SwaggerResourcesProvider {
if(namespace!=null && !"".equals(namespace)){ if(namespace!=null && !"".equals(namespace)){
properties.setProperty("namespace",namespace); properties.setProperty("namespace",namespace);
} }
NamingService naming = NamingFactory.createNamingService(properties); //【issues/5115】因swagger文档导致gateway内存溢出
if (this.naming == null) {
this.naming = NamingFactory.createNamingService(properties);
}
List<Instance> list = naming.selectInstances(routeId, true); List<Instance> list = this.naming.selectInstances(routeId, true);
if (ObjectUtil.isNotEmpty(list)) { if (ObjectUtil.isNotEmpty(list)) {
hasRoute = true; hasRoute = true;
} }