Skip to content

Commit 934aba2

Browse files
committed
chore: Add extra condition for emulator tests with concurrent txn
chore: Add extra condition for emulator tests with concurrent txn in ManagedSession
1 parent f2371fc commit 934aba2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

apis/Google.Cloud.Spanner.V1/Google.Cloud.Spanner.V1/ManagedSession.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,10 @@ internal bool SessionHasExpired(double intervalInDays = SoftRefreshIntervalInDay
154154
{
155155
DateTime currentTime = _clock.GetCurrentDateTimeUtc();
156156
DateTime? sessionCreateTime = _session?.CreateTime.ToDateTime(); // Inherent conversion into UTC DateTime
157-
if (_session == null || _session.Expired || currentTime - sessionCreateTime >= TimeSpan.FromDays(intervalInDays))
157+
if (_session == null
158+
|| _session.Expired
159+
|| !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("SPANNER_EMULATOR_HOST"))
160+
|| currentTime - sessionCreateTime >= TimeSpan.FromDays(intervalInDays))
158161
{
159162
return true;
160163
}

0 commit comments

Comments
 (0)