mirror of
https://github.com/livekit/livekit.git
synced 2026-12-04 09:48:10 +00:00
* service: answer StopEgress for an ended egress without waiting A stop for an egress that already ended finds no server subscribed to its topic. On NATS psrpc reports that at once, but its retry interceptor then waits out the request timeout before each retry, so the API answered 412 only after about 8 s. StopEgress now sends the stop without psrpc's no-subscriber retry and asks the IO service for the egress instead. An ended egress gets 412 and an unknown one 404 at once. A starting or active egress that nothing is subscribed for yet is retried every second for up to 3 seconds. DeleteIngress and UpdateIngress only log a failed RPC to the ingress, so they send it without the no-subscriber retry too. Bumps psrpc for middleware.WithoutNoSubscriberRetry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uq3jhDWWfeXi18uQ1wMJv6 * deps: bump psrpc to claim queue rpcs on non-NATS buses psrpc after v0.8.2 stopped claiming queue rpcs, so on the local and Redis buses a queue rpc with no subscriber timed out instead of failing with ErrNoResponse after the selection timeout. That broke TestJobTerminateReleasesJob. The new pseudo-version claims queue rpcs again on buses that do not report unsubscribed requests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uq3jhDWWfeXi18uQ1wMJv6 * service: retry an active ingress the way StopEgress retries a live egress UpdateIngress and DeleteIngress send their RPC only when the stored state says the ingress is buffering or publishing. When no ingress is subscribed, they now reload the ingress and retry every second for up to 3 seconds while it is still active, as StopEgress does for a live egress. A stale state that is no longer active returns at once. The RPC error is still only logged. The retry timing is shared by egress and ingress, so it is renamed from stopEgressRetry* to noSubscriberRetry*. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uq3jhDWWfeXi18uQ1wMJv6 * deps: pin psrpc to the merged livekit/psrpc#177 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uq3jhDWWfeXi18uQ1wMJv6 --------- Co-authored-by: Claude <noreply@anthropic.com>
26 lines
1.1 KiB
Go
26 lines
1.1 KiB
Go
// Copyright 2026 LiveKit, Inc.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package service
|
|
|
|
import "time"
|
|
|
|
// SetNoSubscriberRetry shortens the egress and ingress no-subscriber retries for
|
|
// a test, and returns a func that restores them.
|
|
func SetNoSubscriberRetry(timeout, interval time.Duration) func() {
|
|
prevTimeout, prevInterval := noSubscriberRetryTimeout, noSubscriberRetryInterval
|
|
noSubscriberRetryTimeout, noSubscriberRetryInterval = timeout, interval
|
|
return func() { noSubscriberRetryTimeout, noSubscriberRetryInterval = prevTimeout, prevInterval }
|
|
}
|