bugfix with plugin receivedAt time and sourceType

This commit is contained in:
Doug Hoyte
2023-09-08 17:28:29 -04:00
parent 20148b1d7d
commit 90494cb8b3
4 changed files with 7 additions and 7 deletions

View File

@ -183,7 +183,7 @@ struct Router {
std::string okMsg;
auto res = pluginDown.acceptEvent(pluginDownCmd, evJson, hoytech::curr_time_s(), EventSourceType::Stream, url, okMsg);
auto res = pluginDown.acceptEvent(pluginDownCmd, evJson, hoytech::curr_time_us(), EventSourceType::Stream, url, okMsg);
if (res == PluginEventSifterResult::Accept) {
router->writer.write({ std::move(evJson), EventSourceType::Stream, url });
} else {
@ -191,7 +191,7 @@ struct Router {
}
}
void outgoingEvent(lmdb::txn &txn, const defaultDb::environment::View_Event &ev, std::string &responseStr, tao::json::value &evJson) {
void outgoingEvent(lmdb::txn &txn, defaultDb::environment::View_Event &ev, std::string &responseStr, tao::json::value &evJson) {
if (dir == "down") return;
if (!filterCompiled.doesMatch(ev.flat_nested())) return;
@ -206,7 +206,7 @@ struct Router {
std::string okMsg;
auto res = pluginUp.acceptEvent(pluginUpCmd, evJson, hoytech::curr_time_s(), EventSourceType::Stream, "", okMsg);
auto res = pluginUp.acceptEvent(pluginUpCmd, evJson, ev.receivedAt(), (EventSourceType)ev.sourceType(), ev.sourceInfo(), okMsg);
if (res == PluginEventSifterResult::Accept) {
for (auto &[url, c] : conns) {
if (c.ws) c.ws->send(responseStr.data(), responseStr.size(), uWS::OpCode::TEXT, nullptr, nullptr, true);

View File

@ -67,7 +67,7 @@ void cmd_stream(const std::vector<std::string> &subArgs) {
auto &evJson = origJson.at(2);
std::string okMsg;
auto res = writePolicyPlugin.acceptEvent(cfg().relay__writePolicy__plugin, evJson, hoytech::curr_time_s(), EventSourceType::Stream, ws.remoteAddr, okMsg);
auto res = writePolicyPlugin.acceptEvent(cfg().relay__writePolicy__plugin, evJson, hoytech::curr_time_us(), EventSourceType::Stream, ws.remoteAddr, okMsg);
if (res == PluginEventSifterResult::Accept) {
downloadedIds.emplace(from_hex(evJson.at("id").get_string()));
writer.write({ std::move(evJson), EventSourceType::Stream, url });

View File

@ -160,7 +160,7 @@ void cmd_sync(const std::vector<std::string> &subArgs) {
auto &evJson = msg.at(2);
std::string okMsg;
auto res = writePolicyPlugin.acceptEvent(cfg().relay__writePolicy__plugin, evJson, hoytech::curr_time_s(), EventSourceType::Sync, ws.remoteAddr, okMsg);
auto res = writePolicyPlugin.acceptEvent(cfg().relay__writePolicy__plugin, evJson, hoytech::curr_time_us(), EventSourceType::Sync, ws.remoteAddr, okMsg);
if (res == PluginEventSifterResult::Accept) {
writer.write({ std::move(evJson), EventSourceType::Sync, url });
} else {