mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
chore: remove mutex-start log
This commit is contained in:
@@ -1,7 +1,3 @@
|
|||||||
import logger from './logger'
|
|
||||||
|
|
||||||
const MUTEX_TIMEOUT_MS = 60_000
|
|
||||||
|
|
||||||
export const makeMutex = () => {
|
export const makeMutex = () => {
|
||||||
let task = Promise.resolve() as Promise<any>
|
let task = Promise.resolve() as Promise<any>
|
||||||
|
|
||||||
@@ -10,19 +6,12 @@ export const makeMutex = () => {
|
|||||||
return {
|
return {
|
||||||
mutex<T>(code: () => Promise<T> | T): Promise<T> {
|
mutex<T>(code: () => Promise<T> | T): Promise<T> {
|
||||||
task = (async() => {
|
task = (async() => {
|
||||||
const stack = new Error('mutex start').stack
|
|
||||||
let waitOver = false
|
|
||||||
taskTimeout = setTimeout(() => {
|
|
||||||
logger.warn({ stack, waitOver }, 'possible mutex deadlock')
|
|
||||||
}, MUTEX_TIMEOUT_MS)
|
|
||||||
// wait for the previous task to complete
|
// wait for the previous task to complete
|
||||||
// if there is an error, we swallow so as to not block the queue
|
// if there is an error, we swallow so as to not block the queue
|
||||||
try {
|
try {
|
||||||
await task
|
await task
|
||||||
} catch{ }
|
} catch{ }
|
||||||
|
|
||||||
waitOver = true
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// execute the current task
|
// execute the current task
|
||||||
const result = await code()
|
const result = await code()
|
||||||
|
|||||||
Reference in New Issue
Block a user