Comments (3)
@crixusshen
首先,NodeJS 是单线程的,而接口实现是异步的方式,每接受到一个请求后就开始异步取数据,这时也可以处理下一个请求,每当数据处理完成后就立即返回;然后,你所说的阻塞的情况,应该是线程的很多时间被用于生成随机数了,后面我会考虑支持用子进程去生成数据。
from grunt-restful-mock.
@bubkoo
好的,现在基本都采用Promise+的规范,特别在某些场景下确实需要同时获取好几个接口,当接口(当然都是异步的)数据全部返回后渲染界面,在这种情况下就希望mock可以提供一个类似多线程的环境,不然在测试过程中将会产生额外的时间消耗开销。github上有一个kriskowal/asap的实现,是基于多任务多线程的,实现很简单也提供了browser的支持,建议采用这样的机制来生成数据。
from grunt-restful-mock.
@crixusshen 建议很好,我会尽快找方案实现,当然你也可以提交 pull request,欢迎贡献代码。
👍 👍 👍
from grunt-restful-mock.
Related Issues (5)
- 是否可以和grunt-contrib-connect 配合使用 HOT 1
- 为什么data不能返回 [{},{}] HOT 3
- 补全单元测试
- watch监听文件变化无效 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grunt-restful-mock.