Skip to content

Commit

Permalink
Update algorithm to wait for available session URL #210
Browse files Browse the repository at this point in the history
* previous implementation was with ever increasing waiting times
* instead use a 4 step approach that increases waiting times at lower
pace
  • Loading branch information
jfaltermeier committed Aug 30, 2023
1 parent ba6092c commit 46b7f2e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
4 changes: 4 additions & 0 deletions java/operator/org.eclipse.theia.cloud.operator/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
additivity="false">
<AppenderRef ref="Console" />
</Logger>
<Logger name="org.eclipse.theia.cloud.operator.TheiaCloudImpl" level="info"
additivity="false">
<AppenderRef ref="Console" />
</Logger>
<Logger name="org.eclipse.theia.cloud.operator" level="trace"
additivity="false">
<AppenderRef ref="Console" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,30 @@ public static void updateSessionURLAsync(NamespacedKubernetesClient client, Sess
String url, String correlationId) {
EXECUTOR.execute(() -> {
boolean updateURL = false;
for (int i = 1; i <= 60; i++) {
for (int i = 1; i <= 100; i++) {
try {
Thread.sleep(i * 1000);
/*
* On the first 15 loops we will check every 2.5s whether URL is available. This
* will take at least 37.5s.
*
* On the second 15 loops we will check every 5s. This will take at least 75s.
*
* On the next 15 loops we will check every 10s. This will take at least further
* 150s.
*
* If the pod has not started within the first 4-5 minutes, we will continue to
* check every minute. We give up after an hour.
*
*/
if (i <= 15) {
Thread.sleep(2500);
} else if (i <= 30) {
Thread.sleep(5000);
} else if (i <= 45) {
Thread.sleep(10000);
} else {
Thread.sleep(60000);
}
} catch (InterruptedException e) {
/* silent */
}
Expand Down

0 comments on commit 46b7f2e

Please sign in to comment.