some fixes
This commit is contained in:
@@ -192,18 +192,22 @@ auto build_payload_json(
|
||||
});
|
||||
}
|
||||
|
||||
// Fix #48: stamp every packet with a numeric build-time generation
|
||||
// (`gen`, epoch ms). A cached snapshot re-sent verbatim to a new client
|
||||
// keeps its original `gen`, so a consumer can compute the snapshot's true
|
||||
// age and flag a stalled pipeline (which `tim` alone cannot express, having
|
||||
// no date and rolling over at midnight).
|
||||
const Json root{
|
||||
Json root{
|
||||
{"ver", protocol_version},
|
||||
{"tim", format_timestamp_now()},
|
||||
{"gen", epoch_millis_now()},
|
||||
{"sts", status},
|
||||
{"obs", std::move(obs_array)},
|
||||
};
|
||||
|
||||
// `gen` is a build-time generation stamp (epoch ms) that lets a consumer compute
|
||||
// a packet's true age and flag a cached/stalled snapshot — something `tim` cannot
|
||||
// express, having no date and rolling over at midnight. It is currently NOT sent;
|
||||
// set this flag to true to re-enable it (epoch_millis_now() is kept ready for that).
|
||||
constexpr bool kEmitGenerationStamp = false;
|
||||
if (kEmitGenerationStamp) {
|
||||
root["gen"] = epoch_millis_now();
|
||||
}
|
||||
|
||||
return root.dump();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user