문제

When you call a synchronous function on the Meteor server, does it block the entire server until the callback is received?

queueTask = function(callback) { ... }
queueTaskSync = Meteor._wrapAsync(queueTask)
queueTaskSync(function(results) {
    console.log('callback returns after 10 seconds')
    Results.insert(results)
})

In other words, if the callback takes 10 seconds to return, does this mean the server cannot do anything else for 10 seconds?

도움이 되었습니까?

해결책

It depends where this code is. If the code is in a Meteor.methods on the server additional calls to meteor from the same client will be blocked, but other's wouldn't be blocked since they are in different fibers.

You can bypass this using this.unblock() in your method to make sure the next method calls are run in new fibers, thus making them more concurrent-like.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top