|
@@ -460,6 +460,30 @@ end:
|
|
|
pthread_exit(NULL/*(void *) fname*/);
|
|
|
}
|
|
|
|
|
|
+int isQueueOverSize()
|
|
|
+{
|
|
|
+ FILE *fp;
|
|
|
+ uint32_t file_size;
|
|
|
+ uint8_t result = FALSE;
|
|
|
+
|
|
|
+ fp = fopen("/Storage/OCPP/TransactionRelatedQueue" , "r");
|
|
|
+ if(fp != NULL)
|
|
|
+ {
|
|
|
+ fseek(fp, 0L, SEEK_END);
|
|
|
+ file_size = ftell(fp);
|
|
|
+
|
|
|
+ if(file_size > (500*1024*1024))
|
|
|
+ {
|
|
|
+ result = TRUE;
|
|
|
+
|
|
|
+ DEBUG_WARN("Queue file over size.\n");
|
|
|
+ }
|
|
|
+ fclose(fp);
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
int showfront(char *uuid, char *data)
|
|
|
{
|
|
|
FILE *fp;
|
|
@@ -1210,6 +1234,7 @@ void CheckTransactionPacket(char *uuid)
|
|
|
int queue_operation(int type, char *frontUUID, char *frontData)
|
|
|
{
|
|
|
int result=0;
|
|
|
+
|
|
|
while(1)
|
|
|
{
|
|
|
if (!IsUsing )
|
|
@@ -1234,7 +1259,11 @@ int queue_operation(int type, char *frontUUID, char *frontData)
|
|
|
}
|
|
|
else if(type == QUEUE_OPERATION_ADD) // add items to the queue
|
|
|
{
|
|
|
- result = addq(frontUUID, frontData);
|
|
|
+ // If queue file over size only add start * stop transaction message
|
|
|
+ if(!isQueueOverSize() || (strstr(frontData, "MeterValues") == NULL))
|
|
|
+ {
|
|
|
+ result = addq(frontUUID, frontData);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
IsUsing = FALSE;
|