Giter VIP home page Giter VIP logo

Comments (3)

bubkoo avatar bubkoo commented on August 23, 2024

@crixusshen
首先,NodeJS 是单线程的,而接口实现是异步的方式,每接受到一个请求后就开始异步取数据,这时也可以处理下一个请求,每当数据处理完成后就立即返回;然后,你所说的阻塞的情况,应该是线程的很多时间被用于生成随机数了,后面我会考虑支持用子进程去生成数据。

from grunt-restful-mock.

crixusshen avatar crixusshen commented on August 23, 2024

@bubkoo
好的,现在基本都采用Promise+的规范,特别在某些场景下确实需要同时获取好几个接口,当接口(当然都是异步的)数据全部返回后渲染界面,在这种情况下就希望mock可以提供一个类似多线程的环境,不然在测试过程中将会产生额外的时间消耗开销。github上有一个kriskowal/asap的实现,是基于多任务多线程的,实现很简单也提供了browser的支持,建议采用这样的机制来生成数据。

from grunt-restful-mock.

bubkoo avatar bubkoo commented on August 23, 2024

@crixusshen 建议很好,我会尽快找方案实现,当然你也可以提交 pull request,欢迎贡献代码。

👍 👍 👍

from grunt-restful-mock.

Related Issues (5)

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.