mirror of
https://github.com/umami-software/umami.git
synced 2026-02-14 01:25:37 +01:00
Converted global to globalThis.
This commit is contained in:
parent
886b7e9e56
commit
c969603001
9 changed files with 25 additions and 22 deletions
|
|
@ -41,7 +41,7 @@ function getClient() {
|
|||
});
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
global[KAFKA] = client;
|
||||
globalThis[KAFKA] = client;
|
||||
}
|
||||
|
||||
log('Kafka initialized');
|
||||
|
|
@ -54,7 +54,7 @@ async function getProducer(): Promise<Producer> {
|
|||
await producer.connect();
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
global[KAFKA_PRODUCER] = producer;
|
||||
globalThis[KAFKA_PRODUCER] = producer;
|
||||
}
|
||||
|
||||
log('Kafka producer initialized');
|
||||
|
|
@ -91,10 +91,10 @@ async function sendMessage(
|
|||
|
||||
async function connect(): Promise<Kafka> {
|
||||
if (!kafka) {
|
||||
kafka = process.env.KAFKA_URL && process.env.KAFKA_BROKER && (global[KAFKA] || getClient());
|
||||
kafka = process.env.KAFKA_URL && process.env.KAFKA_BROKER && (globalThis[KAFKA] || getClient());
|
||||
|
||||
if (kafka) {
|
||||
producer = global[KAFKA_PRODUCER] || (await getProducer());
|
||||
producer = globalThis[KAFKA_PRODUCER] || (await getProducer());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue