wait sql init successfully
This commit is contained in:
+6
-4
@@ -37,12 +37,11 @@ namespace SafeBagDE70
|
||||
public static string BaseURL = "";
|
||||
public static int TenantId = 0;
|
||||
public static DeviceStatus? DeviceStatus = null;
|
||||
|
||||
public static bool bInitUser = false;
|
||||
public static void Init()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
CDMSTATE = new CDMSTATE();
|
||||
DeviceStatus = new DeviceStatus
|
||||
{
|
||||
@@ -55,7 +54,7 @@ namespace SafeBagDE70
|
||||
Notes = "",
|
||||
OtherError = 0,
|
||||
};
|
||||
InitUsers();
|
||||
bInitUser=InitUsers();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -69,7 +68,7 @@ namespace SafeBagDE70
|
||||
|
||||
}
|
||||
|
||||
private static void InitUsers()
|
||||
private static bool InitUsers()
|
||||
{
|
||||
int retryCount = 0;
|
||||
int maxRetries = 20; // Max retries before giving up
|
||||
@@ -97,6 +96,8 @@ namespace SafeBagDE70
|
||||
}
|
||||
CurrentCustomerAccount = customerAccounts[0];
|
||||
Log.Information("InitUsers thành công");
|
||||
bInitUser = true;
|
||||
break;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -116,6 +117,7 @@ namespace SafeBagDE70
|
||||
Thread.Sleep(delay);
|
||||
}
|
||||
}
|
||||
return bInitUser;
|
||||
}
|
||||
public static CDMSTATE? CDMSTATE = null;
|
||||
private static DateTime CutOffTime = new DateTime(1, 1, 1, 12, 0, 0); // 12:00 noon as cut-off time
|
||||
|
||||
Reference in New Issue
Block a user