File tree Expand file tree Collapse file tree 3 files changed +49
-3
lines changed
chat/src/main/java/meet_at_mensa/chat
matching/src/main/java/meet_at_mensa/matching
user/src/main/java/meet_at_mensa/user Expand file tree Collapse file tree 3 files changed +49
-3
lines changed Original file line number Diff line number Diff line change 44import org .springframework .boot .autoconfigure .SpringBootApplication ;
55import org .springframework .web .bind .annotation .GetMapping ;
66import org .springframework .web .bind .annotation .RestController ;
7+ import java .util .concurrent .TimeUnit ;
78
89@ SpringBootApplication
910// ChatApplication is the main class for the chat application
@@ -12,9 +13,31 @@ public class ChatApplication {
1213 // The main method is the entry point of the chat service
1314 // It starts the Spring Boot application
1415 public static void main (String [] args ) {
16+
17+ wait_for_database_startup ();
18+
1519 SpringApplication .run (ChatApplication .class , args );
1620 }
1721
22+ // Wait 30s to ensure that databases have started
23+ private static void wait_for_database_startup () {
24+
25+ System .out .println ("Waiting for databases to start..." );
26+
27+ try {
28+
29+ TimeUnit .SECONDS .sleep (30 );
30+
31+ } catch (InterruptedException e ) {
32+
33+ Thread .currentThread ().interrupt ();
34+ System .out .println ("Wait was interrupted" );
35+
36+ }
37+
38+ System .out .println ("Done waiting for databases to start" );
39+ }
40+
1841 @ RestController
1942 // HelloController is a REST controller that handles HTTP GET requests
2043 // It returns a greeting message in plain text
Original file line number Diff line number Diff line change 44import org .springframework .boot .autoconfigure .SpringBootApplication ;
55import org .springframework .web .bind .annotation .GetMapping ;
66import org .springframework .web .bind .annotation .RestController ;
7+ import java .util .concurrent .TimeUnit ;
78
89@ SpringBootApplication
910// MatchingApplication is the main class for the matching application
@@ -12,9 +13,31 @@ public class MatchingApplication {
1213 // The main method is the entry point of the matching service
1314 // It starts the Spring Boot application
1415 public static void main (String [] args ) {
16+
17+ wait_for_database_startup ();
18+
1519 SpringApplication .run (MatchingApplication .class , args );
1620 }
1721
22+ // Wait 30s to ensure that databases have started
23+ private static void wait_for_database_startup () {
24+
25+ System .out .println ("Waiting for databases to start..." );
26+
27+ try {
28+
29+ TimeUnit .SECONDS .sleep (30 );
30+
31+ } catch (InterruptedException e ) {
32+
33+ Thread .currentThread ().interrupt ();
34+ System .out .println ("Wait was interrupted" );
35+
36+ }
37+
38+ System .out .println ("Done waiting for databases to start" );
39+ }
40+
1841 @ RestController
1942 // HelloController is a REST controller that handles HTTP GET requests
2043 // It returns a greeting message in plain text
Original file line number Diff line number Diff line change @@ -19,20 +19,20 @@ public static void main(String[] args) {
1919 SpringApplication .run (UserApplication .class , args );
2020 }
2121
22- // Wait 20s to ensure that databases have started
22+ // Wait 30s to ensure that databases have started
2323 private static void wait_for_database_startup () {
2424
2525 System .out .println ("Waiting for databases to start..." );
2626
2727 try {
2828
29- TimeUnit .SECONDS .sleep (20 );
29+ TimeUnit .SECONDS .sleep (30 );
3030
3131 } catch (InterruptedException e ) {
3232
3333 Thread .currentThread ().interrupt ();
3434 System .out .println ("Wait was interrupted" );
35-
35+
3636 }
3737
3838 System .out .println ("Done waiting for databases to start" );
You can’t perform that action at this time.
0 commit comments