update Program.cs
This commit is contained in:
parent
29c6217990
commit
d7b91d4dec
|
@ -58,7 +58,6 @@ internal static class Program
|
||||||
private static Boolean _subscribedToQueue = false;
|
private static Boolean _subscribedToQueue = false;
|
||||||
private static Boolean _subscribeToQueueForTheFirstTime = false;
|
private static Boolean _subscribeToQueueForTheFirstTime = false;
|
||||||
private static SalimaxAlarmState _prevSalimaxState = SalimaxAlarmState.Green;
|
private static SalimaxAlarmState _prevSalimaxState = SalimaxAlarmState.Green;
|
||||||
//private static Int32 _heartBitInterval = 0;
|
|
||||||
private const UInt16 NbrOfFileToConcatenate = 30;
|
private const UInt16 NbrOfFileToConcatenate = 30;
|
||||||
private static UInt16 _counterOfFile = 0;
|
private static UInt16 _counterOfFile = 0;
|
||||||
private static SalimaxAlarmState _salimaxAlarmState = SalimaxAlarmState.Green;
|
private static SalimaxAlarmState _salimaxAlarmState = SalimaxAlarmState.Green;
|
||||||
|
@ -704,12 +703,12 @@ internal static class Program
|
||||||
_counterOfFile = 0;
|
_counterOfFile = 0;
|
||||||
|
|
||||||
var logFileConcatenator = new LogFileConcatenator();
|
var logFileConcatenator = new LogFileConcatenator();
|
||||||
var csvToSend = logFileConcatenator.ConcatenateFiles(NbrOfFileToConcatenate);
|
|
||||||
|
|
||||||
var s3Path = timeStamp.ToUnixTime() + ".csv";
|
var s3Path = timeStamp.ToUnixTime() + ".csv";
|
||||||
var request = s3Config.CreatePutRequest(s3Path);
|
s3Path.WriteLine("");
|
||||||
|
var csvToSend = logFileConcatenator.ConcatenateFiles(NbrOfFileToConcatenate);
|
||||||
|
|
||||||
"Sending to S3".WriteLine();
|
var request = s3Config.CreatePutRequest(s3Path);
|
||||||
|
|
||||||
//Use this for no compression
|
//Use this for no compression
|
||||||
//var response = await request.PutAsync(new StringContent(csv));
|
//var response = await request.PutAsync(new StringContent(csv));
|
||||||
|
@ -729,11 +728,21 @@ internal static class Program
|
||||||
Console.WriteLine("ERROR: PUT");
|
Console.WriteLine("ERROR: PUT");
|
||||||
var error = await response.GetStringAsync();
|
var error = await response.GetStringAsync();
|
||||||
Console.WriteLine(error);
|
Console.WriteLine(error);
|
||||||
|
Heartbit(0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine("----------------------------------------Sending Heartbit----------------------------------------");
|
Console.WriteLine("----------------------------------------Sending Heartbit----------------------------------------");
|
||||||
|
|
||||||
|
Heartbit(timeStamp);
|
||||||
|
}
|
||||||
|
_counterOfFile++;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Heartbit(DateTime timeStamp)
|
||||||
|
{
|
||||||
var s3Bucket = Config.Load().S3?.Bucket;
|
var s3Bucket = Config.Load().S3?.Bucket;
|
||||||
int.TryParse(s3Bucket?.Split("-")[0], out var installationId);
|
int.TryParse(s3Bucket?.Split("-")[0], out var installationId);
|
||||||
int.TryParse(timeStamp.ToUnixTime().ToString(), out var nameOfCsvFile);
|
int.TryParse(timeStamp.ToUnixTime().ToString(), out var nameOfCsvFile);
|
||||||
|
@ -750,11 +759,6 @@ internal static class Program
|
||||||
|
|
||||||
if (s3Bucket != null)
|
if (s3Bucket != null)
|
||||||
RabbitMqManager.InformMiddleware(returnedStatus);
|
RabbitMqManager.InformMiddleware(returnedStatus);
|
||||||
|
|
||||||
}
|
|
||||||
_counterOfFile++;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Byte[] CompresseBytes(String csvToSend)
|
private static Byte[] CompresseBytes(String csvToSend)
|
||||||
|
|
Loading…
Reference in New Issue