File tree Expand file tree Collapse file tree 1 file changed +32
-10
lines changed
.github/workflows/scripts Expand file tree Collapse file tree 1 file changed +32
-10
lines changed Original file line number Diff line number Diff line change @@ -5,14 +5,36 @@ if ! [ -x "$(command -v firebase)" ]; then
5
5
fi
6
6
7
7
EMU_START_COMMAND=" firebase emulators:start --only auth,database,firestore --project react-native-firebase-testing"
8
+ # EMU_START_COMMAND="sleep 120"
9
+ MAX_RETRIES=3
10
+ MAX_CHECKATTEMPTS=60
11
+ CHECKATTEMPTS_WAIT=1
8
12
9
- if [ " $1 " == " --no-daemon" ]; then
10
- $EMU_START_COMMAND
11
- else
12
- $EMU_START_COMMAND &
13
- until curl --output /dev/null --silent --fail http://localhost:8080; do
14
- echo " Waiting for Firestore emulator to come online..."
15
- sleep 2
16
- done
17
- echo " Firestore emulator is online!"
18
- fi
13
+
14
+ RETRIES=1
15
+ while [ $RETRIES -le $MAX_RETRIES ]; do
16
+
17
+ if [ " $1 " == " --no-daemon" ]; then
18
+ echo " Starting Firebase Emulator Suite in foreground."
19
+ $EMU_START_COMMAND
20
+ else
21
+ echo " Starting Firebase Emulator Suite in background."
22
+ $EMU_START_COMMAND &
23
+ CHECKATTEMPTS=1
24
+ while [ $CHECKATTEMPTS -le $MAX_CHECKATTEMPTS ]; do
25
+ sleep $CHECKATTEMPTS_WAIT
26
+ if curl --output /dev/null --silent --fail http://localhost:8080; then
27
+ echo " Firebase Emulator Suite is online!"
28
+ exit 0;
29
+ fi
30
+ echo " Waiting for Firebase Emulator Suite to come online, check $CHECKATTEMPTS of $MAX_CHECKATTEMPTS ..."
31
+ (( CHECKATTEMPTS = CHECKATTEMPTS + 1 ))
32
+ done
33
+ fi
34
+
35
+ echo " Firebase Emulator Suite did not come online in $MAX_CHECKATTEMPTS checks. Try $RETRIES of $MAX_RETRIES ."
36
+ (( RETRIES = RETRIES + 1 ))
37
+
38
+ done
39
+ echo " Firebase Emulator Suite did not come online after $MAX_RETRIES attempts."
40
+ exit 1
You can’t perform that action at this time.
0 commit comments