public void ScheduleTimeout() { _execution?.Cancel(); _execution = _delayedExecutor.Execute(() => { _tries += 1; _callback(); }, _timerCalc(_tries + 1)); }
private void SendHeartbeat() { if (!Opts.HeartbeatInterval.HasValue || _pendingHeartbeatRef != null && !IsConnected()) { return; } _pendingHeartbeatRef = MakeRef(); Push(new Message( "phoenix", "heartbeat", @ref: _pendingHeartbeatRef )); _heartbeatTimer = Opts.DelayedExecutor.Execute( HeartbeatTimeout, Opts.HeartbeatInterval.Value ); }
internal void StartTimeout() { // PhoenixJS: null check implicit CancelTimeout(); Ref = _channel.Socket.MakeRef(); _refEvent = Channel.ReplyEventName(Ref); var serializer = _channel.Socket.Opts.MessageSerializer; _channel.On(_refEvent, message => { CancelRefEvent(); CancelTimeout(); _receivedResp = serializer.MapReply(message.Payload); MatchReceive(_receivedResp); }); _delayedExecution = _channel.Socket.Opts.DelayedExecutor.Execute(() => { Trigger(ReplyStatus.Timeout); }, _timeout); }
public void Reset() { _tries = 0; _execution?.Cancel(); _execution = null; }
internal void CancelTimeout() { _delayedExecution?.Cancel(); _delayedExecution = null; }