Puppetteer autoscroll works on windows, but not on linux

i am using puppetteer and i have a autoscroll like this

export const autoScroll = async (page, durationInSeconds) => {
  const totalHeight = await page.evaluate(() => {
    return document.body.scrollHeight - window.innerHeight
  })

  let totalScrolled = 0
  const scrollStep = totalHeight / (durationInSeconds * 60)
  const timeInterval = (durationInSeconds * 1000) / (totalHeight / scrollStep) // Time in milliseconds

  return new Promise((resolve, reject) => {
    const scrollInterval = setInterval(async () => {
      // Scroll by the step.
      await page.mouse.wheel({ deltaY: scrollStep })
      totalScrolled += scrollStep

      if (totalScrolled >= totalHeight) {
        clearInterval(scrollInterval)
        resolve()
      }
    }, timeInterval)
  })

The problem is that this gives the expected output on windows so the scrolling takes the amount that is provided in the parameters but on linux it does the autoscroll 4-5 seconds too fast so it just stays at the bottom the rest 4-5 seconds, what could be the reason?