提交 2ad3eed7 authored 作者: blu's avatar blu

bugfix: resched event upload task

上级 ee88faf1
...@@ -908,7 +908,7 @@ public: ...@@ -908,7 +908,7 @@ public:
{ {
string evt; string evt;
int ret = 0; int ret = 0;
// scoped
{ {
unique_lock<mutex> lk(this->mutEvent); unique_lock<mutex> lk(this->mutEvent);
this->cvEvent.wait(lk, [this] {return !(this->eventQueue.empty());}); this->cvEvent.wait(lk, [this] {return !(this->eventQueue.empty());});
...@@ -944,19 +944,21 @@ public: ...@@ -944,19 +944,21 @@ public:
if(tse < first) { if(tse < first) {
spdlog::info("evslicer {} thEventHandler event range ({}, {}) is not in range ({}, {}).", selfId, tss, tse, first, end); spdlog::info("evslicer {} thEventHandler event range ({}, {}) is not in range ({}, {}).", selfId, tss, tse, first, end);
return ret; continue;
}else if(first == 0||tse > end) { }else if(first == 0||tse > end) {
spdlog::info("evslicer {} thEventHandler event range ({}, {}) is not in range ({}, {}), resched to run in {}s.", selfId, tss, tse, first, end, this->seconds + 5); spdlog::info("evslicer {} thEventHandler event range ({}, {}) is not in range ({}, {}), resched to run in {}s.", selfId, tss, tse, first, end, this->seconds + 5);
thread([this, evt]{ auto th = thread([evt, this](){
this_thread::sleep_for(chrono::seconds(this->seconds + 5)); this_thread::sleep_for(chrono::seconds(this->seconds + 5));
//lock_guard<mutex> lock(this->mutEvent); lock_guard<mutex> lock(this->mutEvent);
this->eventQueue.push(evt); this->eventQueue.push(evt);
if(eventQueue.size() > MAX_EVENT_QUEUE_SIZE) { if(eventQueue.size() > MAX_EVENT_QUEUE_SIZE) {
eventQueue.pop(); eventQueue.pop();
} }
//cvEvent.notify_one(); cvEvent.notify_one();
}).detach(); });
return ret;
th.detach();
continue;
} }
auto v = findSlicesByRange(tss, tse, offsetS, offsetE); auto v = findSlicesByRange(tss, tse, offsetS, offsetE);
...@@ -980,7 +982,7 @@ public: ...@@ -980,7 +982,7 @@ public:
} }
else { else {
spdlog::info("evslicer {} successfully uploaded ({}, {}). local({}, {}) files:\n{}", selfId, tss, tse, this->videoFileTs2Name(tss), this->videoFileTs2Name(tse), first, end, sf); spdlog::info("evslicer {} successfully uploaded ({}, {}). local({}, {}) files:\n{}", selfId, tss, tse, first, end, sf);
} }
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论