don't store receivedAt and source metadata

This commit is contained in:
Doug Hoyte
2024-08-30 16:51:43 -04:00
parent 21d4e07b87
commit 391f632b73
12 changed files with 18 additions and 30 deletions

View File

@ -183,9 +183,9 @@ struct Router {
std::string okMsg;
auto res = pluginDown.acceptEvent(pluginDownCmd, evJson, hoytech::curr_time_us(), EventSourceType::Stream, url, okMsg);
auto res = pluginDown.acceptEvent(pluginDownCmd, evJson, EventSourceType::Stream, url, okMsg);
if (res == PluginEventSifterResult::Accept) {
router->writer.write({ std::move(evJson), EventSourceType::Stream, url });
router->writer.write({ std::move(evJson), });
} else {
if (okMsg.size()) LI << groupName << " / " << url << " : pluginDown blocked event " << evJson.at("id").get_string() << ": " << okMsg;
}
@ -206,7 +206,7 @@ struct Router {
std::string okMsg;
auto res = pluginUp.acceptEvent(pluginUpCmd, evJson, ev.receivedAt(), (EventSourceType)ev.sourceType(), ev.sourceInfo(), okMsg);
auto res = pluginUp.acceptEvent(pluginUpCmd, evJson, EventSourceType::Stored, "", 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,10 +67,10 @@ 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_us(), EventSourceType::Stream, ws.remoteAddr, okMsg);
auto res = writePolicyPlugin.acceptEvent(cfg().relay__writePolicy__plugin, evJson, 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 });
writer.write({ std::move(evJson), });
} else {
if (okMsg.size()) LI << "[" << ws.remoteAddr << "] write policy blocked event " << evJson.at("id").get_string() << ": " << okMsg;
}

View File

@ -168,9 +168,9 @@ 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_us(), EventSourceType::Sync, ws.remoteAddr, okMsg);
auto res = writePolicyPlugin.acceptEvent(cfg().relay__writePolicy__plugin, evJson, EventSourceType::Sync, ws.remoteAddr, okMsg);
if (res == PluginEventSifterResult::Accept) {
writer.write({ std::move(evJson), EventSourceType::Sync, url });
writer.write({ std::move(evJson), });
} else {
if (okMsg.size()) LI << "[" << ws.remoteAddr << "] write policy blocked event " << evJson.at("id").get_string() << ": " << okMsg;
}