File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 66use Firebase \JWT \JWT ;
77use Firebase \JWT \SignatureInvalidException ;
88use GuzzleHttp \Client ;
9+ use GuzzleHttp \Exception \ServerException ;
910use Illuminate \Support \Arr ;
1011use Illuminate \Support \Facades \Cache ;
1112use phpseclib \Crypt \RSA ;
@@ -105,7 +106,23 @@ public function getKidFromOpenIdToken($openIdToken)
105106
106107 private function callApiAndReturnValue ($ url , $ value )
107108 {
108- $ response = $ this ->guzzle ->get ($ url );
109+ $ attempts = 0 ;
110+
111+ while (true ) {
112+ try {
113+ $ response = $ this ->guzzle ->get ($ url );
114+
115+ break ;
116+ } catch (ServerException $ e ) {
117+ $ attempts ++;
118+
119+ if ($ attempts >= 3 ) {
120+ throw $ e ;
121+ }
122+
123+ sleep (1 );
124+ }
125+ }
109126
110127 $ data = json_decode ($ response ->getBody (), true );
111128
You can’t perform that action at this time.
0 commit comments