Ingest EvtSet with zmtp init

This commit is contained in:
Dominik Werder
2023-02-20 16:36:23 +01:00
parent 1ba74e1342
commit c3ac621cc6
5 changed files with 41 additions and 22 deletions
+2 -2
View File
@@ -927,7 +927,7 @@ impl CaConn {
// TODO handle not-found error:
let ch_s = self.channels.get_mut(&cid).unwrap();
let cssid = match ch_s {
ChannelState::Created(_series, st2) => st2.cssid.clone(),
ChannelState::FetchingSeriesId(st2) => st2.cssid.clone(),
_ => {
let name = self.name_by_cid.get(&cid);
let e = Error::with_msg_no_trace(format!("channel_to_evented bad state {name:?} {ch_s:?}"));
@@ -1381,7 +1381,7 @@ impl CaConn {
let cssid = match ch_s {
ChannelState::Creating { cssid, .. } => cssid.clone(),
_ => {
let e = Error::with_msg_no_trace("channel_to_evented bad state");
let e = Error::with_msg_no_trace("handle_peer_ready bad state");
return Ready(Some(Err(e)));
}
};
+4 -1
View File
@@ -119,7 +119,10 @@ impl DbUpdateWorker {
.unwrap();
} else {
warn!("Duplicate for {}", item.channel);
let sql="with q1 as (select ctid from ioc_by_channel_log where facility = $1 and channel = $2 and addr is not distinct from $3 order by tsmod desc, ctid desc limit 1) update ioc_by_channel_log t set archived = 1 from q1 where t.facility = $1 and t.channel = $2 and t.addr is not distinct from $3 and t.ctid != q1.ctid";
let sql = concat!(
"with q1 as (select ctid from ioc_by_channel_log where facility = $1 and channel = $2 and addr is not distinct from $3 order by tsmod desc, ctid desc limit 1)",
" update ioc_by_channel_log t set archived = 1 from q1 where t.facility = $1 and t.channel = $2 and t.ctid != q1.ctid and archived != 1",
);
pg_client.execute(sql, &[&backend, &item.channel, &addr]).await.unwrap();
pg_client
.execute(&qu_update_tsmod, &[&backend, &item.channel, &addr, &responseaddr])
+3 -2
View File
@@ -158,7 +158,7 @@ impl BsreadClient {
ts: u64,
pulse: u64,
) -> Result<(), Error> {
let chname = "SAR-CVME-TIFALL4:EvtSet";
let chname = "SAR-CVME-TIFALL5:EvtSet";
// Test the bool set write
let mut i3 = usize::MAX;
for (i, ch) in bm.head_b.channels.iter().enumerate() {
@@ -675,7 +675,8 @@ impl Zmtp {
complete: false,
socket_type,
conn,
conn_state: ConnState::LockScan(1),
//conn_state: ConnState::LockScan(1),
conn_state: ConnState::InitSend,
buf: NetBuf::new(1024 * 128),
outbuf: NetBuf::new(1024 * 128),
out_enable: false,