add single store delay handling for log store as well
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2023-03-27 22:06:16 +02:00
parent bc72f59abb
commit 9613d4aa51
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 25 additions and 12 deletions

View File

@ -14,13 +14,22 @@ PersistentLogTmStoreTask::PersistentLogTmStoreTask(object_id_t objectId, Storage
ReturnValue_t PersistentLogTmStoreTask::performOperation(uint8_t opCode) {
bool someonesBusy = false;
auto stateHandlingForStore = [&](bool storeIsBusy) {
bool vcBusyDuringDump = false;
bool byteFlowControl = false;
auto stateHandlingForStore = [&](bool storeIsBusy, DumpContext& ctx) {
if (storeIsBusy) {
someonesBusy = true;
}
if (fileHasSwapped) {
someFileWasSwapped = fileHasSwapped;
}
if(ctx.vcBusyDuringDump) {
vcBusyDuringDump = true;
}
if(ctx.dumpedBytes - ctx.bytesDumpedAtLastDelay >= 2048) {
byteFlowControl = true;
ctx.bytesDumpedAtLastDelay = ctx.dumpedBytes;
}
};
while (true) {
if (not cyclicStoreCheck()) {
@ -28,13 +37,21 @@ ReturnValue_t PersistentLogTmStoreTask::performOperation(uint8_t opCode) {
}
someonesBusy = false;
someFileWasSwapped = false;
stateHandlingForStore(handleOneStore(stores.okStore, okStoreContext));
stateHandlingForStore(handleOneStore(stores.notOkStore, notOkStoreContext));
stateHandlingForStore(handleOneStore(stores.miscStore, miscStoreContext));
vcBusyDuringDump = false;
stateHandlingForStore(handleOneStore(stores.okStore, okStoreContext), okStoreContext);
stateHandlingForStore(handleOneStore(stores.notOkStore, notOkStoreContext), notOkStoreContext);
stateHandlingForStore(handleOneStore(stores.miscStore, miscStoreContext), miscStoreContext);
if (not someonesBusy) {
TaskFactory::delayTask(100);
} else if (someFileWasSwapped) {
TaskFactory::delayTask(2);
TaskFactory::delayTask(20);
} else if(vcBusyDuringDump) {
TaskFactory::delayTask(20);
} else if(byteFlowControl) {
TaskFactory::delayTask(10);
} else {
// TODO: Lower this as much as possible...
TaskFactory::delayTask(10);
}
}
}

View File

@ -24,17 +24,13 @@ ReturnValue_t PersistentSingleTmStoreTask::performOperation(uint8_t opCode) {
} else if (fileHasSwapped) {
TaskFactory::delayTask(20);
} else if (dumpContext.packetWasDumped and
dumpContext.numberOfDumpedPackets - dumpContext.bytesDumpedAtLastDelay >= 2048) {
dumpContext.dumpedBytes - dumpContext.bytesDumpedAtLastDelay >= 2048) {
dumpContext.bytesDumpedAtLastDelay = dumpContext.dumpedBytes;
TaskFactory::delayTask(20);
} else {
TaskFactory::delayTask(10);
// TODO: Lower this as much as possible...
TaskFactory::delayTask(5);
}
// else if(dumpContext.numberOfDumpedPackets % 20 == 0) {
// Manual load management because I don't know what the scheduler is doing..
// Removing this delay can lead to evil side effects.
// TaskFactory::delayTask(5);
//}
}
}