Fixed sync bug in HTTP trigger handler
This commit is contained in:
parent
f77f1bc14d
commit
cdc8f0179f
2 changed files with 3 additions and 3 deletions
|
@ -200,8 +200,8 @@ namespace HTTP{
|
||||||
MEDIUM_MSG("Posting to %s (%zu/%" PRIu32 ")", link.getUrl().c_str(), retryCount - loop + 1,
|
MEDIUM_MSG("Posting to %s (%zu/%" PRIu32 ")", link.getUrl().c_str(), retryCount - loop + 1,
|
||||||
retryCount);
|
retryCount);
|
||||||
doRequest(link, "POST", payload);
|
doRequest(link, "POST", payload);
|
||||||
// Not synced? Ignore the response and immediately return false.
|
// Not synced? Ignore the response and immediately return true.
|
||||||
if (!sync){return false;}
|
if (!sync){return true;}
|
||||||
uint64_t reqTime = Util::bootSecs();
|
uint64_t reqTime = Util::bootSecs();
|
||||||
while (getSocket() && Util::bootSecs() < reqTime + dataTimeout){
|
while (getSocket() && Util::bootSecs() < reqTime + dataTimeout){
|
||||||
// No data? Wait for a second or so.
|
// No data? Wait for a second or so.
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace Triggers{
|
||||||
DL.setHeader("X-Trigger", trigger);
|
DL.setHeader("X-Trigger", trigger);
|
||||||
DL.setHeader("Content-Type", "text/plain");
|
DL.setHeader("Content-Type", "text/plain");
|
||||||
HTTP::URL url(value);
|
HTTP::URL url(value);
|
||||||
if (DL.post(url, payload, sync) && sync && DL.isOk()){
|
if (DL.post(url, payload, sync) && (!sync || DL.isOk())){
|
||||||
submitTriggerStat(trigger, tStartMs, true);
|
submitTriggerStat(trigger, tStartMs, true);
|
||||||
return DL.data();
|
return DL.data();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue