fix(opcua): relax subscription timeout handling
This commit is contained in:
parent
c50127b9d0
commit
0b9b7aef7d
|
|
@ -328,7 +328,7 @@ impl ConnectionManager {
|
|||
let manager = self.clone();
|
||||
|
||||
let handle = tokio::spawn(async move {
|
||||
let mut ticker = tokio::time::interval(Duration::from_secs(4)); // 每4秒检测一次心跳
|
||||
let mut ticker = tokio::time::interval(Duration::from_secs(8)); // 每8秒检测一次心跳
|
||||
ticker.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip);
|
||||
|
||||
loop {
|
||||
|
|
@ -1153,14 +1153,21 @@ impl ConnectionManager {
|
|||
match session
|
||||
.create_subscription(
|
||||
Duration::from_secs(1),
|
||||
120,
|
||||
10,
|
||||
30,
|
||||
0,
|
||||
0,
|
||||
true,
|
||||
opcua::client::SubscriptionCallbacks::new(
|
||||
move |notification| {
|
||||
if notification.status.is_bad() {
|
||||
if notification.status == opcua::types::StatusCode::BadTimeout {
|
||||
tracing::warn!(
|
||||
"Subscription publish timeout for source {}, waiting for heartbeat validation before reconnect",
|
||||
current_source_id
|
||||
);
|
||||
return;
|
||||
}
|
||||
tracing::warn!(
|
||||
"Subscription status changed to {:?} for source {}, triggering reconnection",
|
||||
notification.status,
|
||||
|
|
|
|||
Loading…
Reference in New Issue