Skip to content

Commit 9760767

Browse files
author
rezra3
committed
codeine-201 run all project modify plugin runs on a single thread and async
1 parent e114462 commit 9760767

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/peer/codeine/servlets/ReloadConfigurationServlet.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,19 @@ public class ReloadConfigurationServlet extends AbstractServlet {
3131
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
3232
log.info("ReloadConfigurationServlet called");
3333
String parameter = UrlParameters.SYNC_REQUEST;
34-
boolean isSync = Boolean.parseBoolean(getParameter(req, parameter));
34+
final boolean isSync = Boolean.parseBoolean(getParameter(req, parameter));
3535
Runnable thread = new Runnable() {
3636
@Override
3737
public void run() {
38+
if (!isSync) {
39+
doSleep();
40+
}
41+
configurationManager.refresh();
42+
nodesRunner.run();
43+
log.info("ReloadConfigurationServlet finished");
44+
}
45+
46+
private void doSleep() {
3847
try {
3948
long duration = globalConfigurationJsonStore.get().large_deployment() ? 60 : 25;
4049
int millis = new Random().nextInt((int) TimeUnit.SECONDS.toMillis(duration));
@@ -43,9 +52,6 @@ public void run() {
4352
} catch (InterruptedException e) {
4453
log.error(e);
4554
}
46-
configurationManager.refresh();
47-
nodesRunner.run();
48-
log.info("ReloadConfigurationServlet async finished");
4955
}
5056
};
5157
if (isSync) {

0 commit comments

Comments
 (0)