sub work
This commit is contained in:
parent
6ba90bf7e5
commit
76f9ce8a79
Binary file not shown.
Binary file not shown.
@ -162,41 +162,50 @@ namespace ClientCollector
|
||||
if (!currDate.HasValue)
|
||||
currDate = new DateTime(2001, 02, 01);
|
||||
var flagcycle = false;
|
||||
{
|
||||
log.Info("Connect to archive.");
|
||||
await CreateConnectionNFS(mainDir);
|
||||
}
|
||||
while (currDate.Value < DateTime.Now.AddDays(-1))
|
||||
{
|
||||
try
|
||||
{
|
||||
while(DateTime.Now.Hour < 12)
|
||||
/*while(DateTime.Now.Hour < 12)
|
||||
{
|
||||
log.Info("Await 12:00.");
|
||||
await Task.Delay(15000 * 60);
|
||||
}
|
||||
log.Info("Connect to archive.");
|
||||
await CreateConnectionNFS(mainDir);
|
||||
}*/
|
||||
var subDir = Path.Combine(mainDir, "data",
|
||||
currDate.Value.Year.ToString("D4"),
|
||||
currDate.Value.Month.ToString("D2"),
|
||||
currDate.Value.Day.ToString("D2"));
|
||||
log.Info("Check dir: " + subDir);
|
||||
if (Directory.Exists(subDir))
|
||||
{
|
||||
var listFiles = Directory.GetFiles(subDir);
|
||||
foreach(var fileDir in listFiles)
|
||||
{
|
||||
log.Info("Get file: " + fileDir);
|
||||
var fileStruct = File.ReadAllBytes(fileDir);
|
||||
log.Info("Send file to API: " + fileDir);
|
||||
while (!SendData(currDate.Value, Path.GetFileName(fileDir), fileStruct))
|
||||
if (Directory.Exists(Path.Combine(mainDir, "data"))) {
|
||||
if (Directory.Exists(subDir))
|
||||
{
|
||||
var listFiles = Directory.GetFiles(subDir);
|
||||
foreach (var fileDir in listFiles)
|
||||
{
|
||||
log.Warn("Can't send data to API.");
|
||||
await Task.Delay(10000);
|
||||
log.Info("Get file: " + fileDir);
|
||||
var fileStruct = File.ReadAllBytes(fileDir);
|
||||
log.Info("Send file to API: " + fileDir);
|
||||
while (!SendData(currDate.Value, Path.GetFileName(fileDir), fileStruct))
|
||||
{
|
||||
log.Warn("Can't send data to API.");
|
||||
await Task.Delay(10000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
log.Info("End day: " + subDir);
|
||||
SaveCurrData(nameCurrDate, currDate.Value);
|
||||
currDate = currDate.Value.AddDays(1);
|
||||
await Task.Delay(1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
log.Warn("Archive not exist.");
|
||||
|
||||
}
|
||||
log.Info("End day: " + subDir);
|
||||
SaveCurrData(nameCurrDate, currDate.Value);
|
||||
currDate = currDate.Value.AddDays(1);
|
||||
await Task.Delay(5000);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -212,7 +221,7 @@ namespace ClientCollector
|
||||
SaveCurrData(nameCurrDate, currDate.Value);
|
||||
}
|
||||
|
||||
static async Task CreateConnectionNFS(string dir)
|
||||
static async Task ConnectNFS(string dir)
|
||||
{
|
||||
var dirCreated = false;
|
||||
while (!dirCreated)
|
||||
|
@ -4,6 +4,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<History>True|2021-08-02T17:58:49.1867297Z;True|2021-08-02T22:56:02.6749724+05:00;True|2021-08-02T22:50:24.0842490+05:00;True|2021-08-02T22:46:50.7307549+05:00;True|2021-08-02T22:46:32.2783734+05:00;True|2021-08-02T22:37:45.7957317+05:00;True|2021-08-02T22:34:37.2905589+05:00;True|2021-08-02T22:31:30.3451541+05:00;True|2021-08-02T12:26:02.5496847+05:00;True|2021-08-01T23:12:48.3492831+05:00;True|2021-08-01T22:53:02.2382201+05:00;True|2021-08-01T22:48:16.9658882+05:00;True|2021-08-01T22:40:58.1479436+05:00;True|2021-08-01T22:28:58.9840017+05:00;True|2021-08-01T20:16:20.5210616+05:00;True|2021-08-01T19:27:43.9900600+05:00;True|2021-08-01T19:18:48.8000969+05:00;True|2021-08-01T19:15:19.9257002+05:00;True|2021-08-01T19:08:17.1315589+05:00;True|2021-07-31T20:35:08.9408458+05:00;True|2021-07-31T20:20:29.0886405+05:00;</History>
|
||||
<History>True|2021-08-03T01:22:57.0758714Z;True|2021-08-03T06:18:08.6594656+05:00;True|2021-08-02T22:58:49.1867297+05:00;True|2021-08-02T22:56:02.6749724+05:00;True|2021-08-02T22:50:24.0842490+05:00;True|2021-08-02T22:46:50.7307549+05:00;True|2021-08-02T22:46:32.2783734+05:00;True|2021-08-02T22:37:45.7957317+05:00;True|2021-08-02T22:34:37.2905589+05:00;True|2021-08-02T22:31:30.3451541+05:00;True|2021-08-02T12:26:02.5496847+05:00;True|2021-08-01T23:12:48.3492831+05:00;True|2021-08-01T22:53:02.2382201+05:00;True|2021-08-01T22:48:16.9658882+05:00;True|2021-08-01T22:40:58.1479436+05:00;True|2021-08-01T22:28:58.9840017+05:00;True|2021-08-01T20:16:20.5210616+05:00;True|2021-08-01T19:27:43.9900600+05:00;True|2021-08-01T19:18:48.8000969+05:00;True|2021-08-01T19:15:19.9257002+05:00;True|2021-08-01T19:08:17.1315589+05:00;True|2021-07-31T20:35:08.9408458+05:00;True|2021-07-31T20:20:29.0886405+05:00;</History>
|
||||
</PropertyGroup>
|
||||
</Project>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user