Skip to content

IO Storm #7

Description

@leonardonerypro

Dear Andres, some time ago I noticed that the API was causing IO Storm and after analysis I identified that the overload of read and write operations on the disk occurred because of the instruction in the whatsapp.js file to perform a save every 10s.

I would like to ask you if you could make the following change in the whatsapp.js file to solve the problem.

Replace this:

    // Save every 10s
    setInterval(() => {
        if (existsSync(sessionsDir(sessionFile))) {
            store?.writeToFile(sessionsDir(`${sessionId}_store.json`))
        }
    }, 10000)

For this:

    // Saves after 60 seconds
    let count = 0
    const maxCount = 6

    const intervalId = setInterval(() => {
        count++
        if (count === maxCount) {
            if (existsSync(sessionsDir(sessionFile))) {
                store?.writeToFile(sessionsDir(`${sessionId}_store.json`))
            }
            clearInterval(intervalId)
        }
     }, 10000)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions