@sentry/core
Version:
Base implementation for all Sentry JavaScript SDKs
21 lines (20 loc) • 724 B
JavaScript
import { getMainCarrier } from "../carrier.js";
import { safeUnref } from "../utils/timer.js";
import { getAsyncContextStrategy } from "./index.js";
// src/asyncContext/tracing-channel-binding.ts
/**
* Execute a callback whenever the tracing channel binding is available.
* If it is not available after retry, the callback is not executed.
*/
function waitForTracingChannelBinding(callback, retries = 1) {
if (getAsyncContextStrategy(getMainCarrier()).getTracingChannelBinding?.()) {
callback();
return;
}
if (!retries) return;
safeUnref(setTimeout(() => {
waitForTracingChannelBinding(callback, retries - 1);
}, 1));
}
export { waitForTracingChannelBinding };
//# sourceMappingURL=tracing-channel-binding.js.map