File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
FirebaseAdmin/FirebaseAdmin.IntegrationTests Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -352,7 +352,22 @@ public async Task LastRefreshTime()
352
352
// Login to cause the LastRefreshTimestamp to be set.
353
353
await SignInWithPasswordAsync ( newUserRecord . Email , "password" ) ;
354
354
355
- var userRecord = await FirebaseAuth . DefaultInstance . GetUserAsync ( newUserRecord . Uid ) ;
355
+ // Attempt to retrieve the user 3 times (with a small delay between each attempt).
356
+ // Occassionally, this call retrieves the user data without the
357
+ // lastLoginTime/lastRefreshTime set; possibly because it's hitting a different
358
+ // server than the login request uses.
359
+ UserRecord userRecord = null ;
360
+ for ( int i = 0 ; i < 3 ; i ++ )
361
+ {
362
+ userRecord = await FirebaseAuth . DefaultInstance . GetUserAsync ( newUserRecord . Uid ) ;
363
+
364
+ if ( userRecord . UserMetaData . LastRefreshTimestamp != null )
365
+ {
366
+ break ;
367
+ }
368
+
369
+ await Task . Delay ( 1000 * ( int ) Math . Pow ( 2 , i ) ) ;
370
+ }
356
371
357
372
// Ensure the LastRefreshTimstamp is approximately "now" (with a tollerance of 10 minutes).
358
373
var now = DateTime . UtcNow ;
You can’t perform that action at this time.
0 commit comments