Coder Social home page Coder Social logo

Scheduler队列设计疑问 about just-react HOT 1 OPEN

betasu avatar betasu commented on July 30, 2024
Scheduler队列设计疑问

from just-react.

Comments (1)

lizuncong avatar lizuncong commented on July 30, 2024

目前React关于Scheduler设计存在两个队列:保存未就绪任务timerQueue和保存已就绪任务taskQueue,每次调度时会判断未就绪任务是否已就绪,是加入到taskQueue。但是从过期时间的角度来看,貌似这种设计有点冗余,如果把延迟的任务也转换为过期时间,然后放在统一的任务队列(假设是taskQueue),统一走最小堆的维护和取值策略,那是不是也能满足需求,并且逻辑上也更简单点

是需要两个队列的,假如没有调度普通的任务(存放在taskQueue中的任务),只调度了延迟任务,这时候是需要为延迟任务启动一个定时器的,而普通任务不需要,因此不能简单的将延迟任务转换为过期时间添加到普通任务队列(taskQueue)中的

from just-react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.