WIP (write message)
This commit is contained in:
@@ -11,6 +11,7 @@ use netpod::ChannelConfigResponse;
|
||||
use netpod::ChannelTypeConfigGen;
|
||||
use netpod::DtNano;
|
||||
use netpod::NodeConfigCached;
|
||||
use netpod::ReqCtx;
|
||||
use netpod::ScalarType;
|
||||
use netpod::SfChFetchInfo;
|
||||
use netpod::SfDbChannel;
|
||||
@@ -175,11 +176,12 @@ pub async fn channel_configs(channel: SfDbChannel, ncc: &NodeConfigCached) -> Re
|
||||
pub async fn http_get_channel_config(
|
||||
qu: ChannelConfigQuery,
|
||||
baseurl: Url,
|
||||
ctx: &ReqCtx,
|
||||
) -> Result<Option<ChannelConfigResponse>, Error> {
|
||||
let url = baseurl;
|
||||
let mut url = url.join("/api/4/channel/config").unwrap();
|
||||
qu.append_to_url(&mut url);
|
||||
let res = httpclient::http_get(url, APP_JSON).await?;
|
||||
let res = httpclient::http_get(url, APP_JSON, ctx).await?;
|
||||
use httpclient::http::StatusCode;
|
||||
if res.head.status == StatusCode::NOT_FOUND {
|
||||
Ok(None)
|
||||
|
||||
@@ -8,6 +8,7 @@ use netpod::ChannelConfigResponse;
|
||||
use netpod::ChannelTypeConfigGen;
|
||||
use netpod::DtNano;
|
||||
use netpod::NodeConfigCached;
|
||||
use netpod::ReqCtx;
|
||||
use netpod::SfChFetchInfo;
|
||||
use netpod::SfDbChannel;
|
||||
use std::collections::BTreeMap;
|
||||
@@ -48,6 +49,7 @@ fn decide_sf_ch_config_quorum(inp: Vec<ChannelConfigResponse>) -> Result<Option<
|
||||
async fn find_sf_ch_config_quorum(
|
||||
channel: SfDbChannel,
|
||||
range: SeriesRange,
|
||||
ctx: &ReqCtx,
|
||||
ncc: &NodeConfigCached,
|
||||
) -> Result<Option<SfChFetchInfo>, Error> {
|
||||
let range = match range {
|
||||
@@ -63,9 +65,12 @@ async fn find_sf_ch_config_quorum(
|
||||
// TODO
|
||||
expand: false,
|
||||
};
|
||||
let res = tokio::time::timeout(Duration::from_millis(4000), http_get_channel_config(qu, node.baseurl()))
|
||||
.await
|
||||
.map_err(|_| Error::with_msg_no_trace("timeout"))??;
|
||||
let res = tokio::time::timeout(
|
||||
Duration::from_millis(4000),
|
||||
http_get_channel_config(qu, node.baseurl(), ctx),
|
||||
)
|
||||
.await
|
||||
.map_err(|_| Error::with_msg_no_trace("timeout"))??;
|
||||
all.push(res);
|
||||
}
|
||||
let all: Vec<_> = all.into_iter().filter_map(|x| x).collect();
|
||||
@@ -84,6 +89,7 @@ async fn find_sf_ch_config_quorum(
|
||||
pub async fn find_config_basics_quorum(
|
||||
channel: SfDbChannel,
|
||||
range: SeriesRange,
|
||||
ctx: &ReqCtx,
|
||||
ncc: &NodeConfigCached,
|
||||
) -> Result<Option<ChannelTypeConfigGen>, Error> {
|
||||
if let Some(_cfg) = &ncc.node.sf_databuffer {
|
||||
@@ -100,7 +106,7 @@ pub async fn find_config_basics_quorum(
|
||||
} else {
|
||||
channel
|
||||
};
|
||||
match find_sf_ch_config_quorum(channel, range, ncc).await? {
|
||||
match find_sf_ch_config_quorum(channel, range, ctx, ncc).await? {
|
||||
Some(x) => Ok(Some(ChannelTypeConfigGen::SfDatabuffer(x))),
|
||||
None => Ok(None),
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ pub async fn create_response_bytes_stream(
|
||||
evq.ch_conf().shape(),
|
||||
);
|
||||
debug!("wasm1 {:?}", evq.wasm1());
|
||||
let reqctx = netpod::ReqCtx::new(evq.reqid());
|
||||
let reqctx = netpod::ReqCtx::new(evq.reqid()).into();
|
||||
if evq.create_errors_contains("nodenet_parse_query") {
|
||||
let e = Error::with_msg_no_trace("produced error on request nodenet_parse_query");
|
||||
return Err(e);
|
||||
|
||||
Reference in New Issue
Block a user