Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
33 lines
870 B
Plaintext
33 lines
870 B
Plaintext
import { getMainCarrier, getSentryCarrier } from '../carrier.js';
|
|
import { getStackAsyncContextStrategy } from './stackStrategy.js';
|
|
|
|
/**
|
|
* @private Private API with no semver guarantees!
|
|
*
|
|
* Sets the global async context strategy
|
|
*/
|
|
function setAsyncContextStrategy(strategy) {
|
|
// Get main carrier (global for every environment)
|
|
const registry = getMainCarrier();
|
|
const sentry = getSentryCarrier(registry);
|
|
sentry.acs = strategy;
|
|
}
|
|
|
|
/**
|
|
* Get the current async context strategy.
|
|
* If none has been setup, the default will be used.
|
|
*/
|
|
function getAsyncContextStrategy(carrier) {
|
|
const sentry = getSentryCarrier(carrier);
|
|
|
|
if (sentry.acs) {
|
|
return sentry.acs;
|
|
}
|
|
|
|
// Otherwise, use the default one (stack)
|
|
return getStackAsyncContextStrategy();
|
|
}
|
|
|
|
export { getAsyncContextStrategy, setAsyncContextStrategy };
|
|
//# sourceMappingURL=index.js.map
|