meteorhacks/unblock

Name: unblock

Owner: meteorhacks

Description: this.unblock inside publications :D

Created: 2014-09-11 07:54:19.0

Updated: 2018-03-03 13:33:43.0

Pushed: 2015-10-03 08:33:25.0

Homepage: null

Size: 203

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Use this.unblock inside Meteor Publications

This is a project to provide this.unblock functionality to publications. this.unblock inside publications is one of most(may be a little bit less) requested feature and but it hasn't been implemented yet!

So, this project implements that feature as a community package thanks to the MeteorX project.

Why unblock?

Meteor executes, DDP messages for a single client in a sequence. So, if one message takes a lot of time to process, that time will add up to all the messages. Luckily, there is an API called this.unblock which can be use inside methods as shown below.

or.methods({
ngMethod: function() {
this.unblock();
Meteor._sleepForMs(1000 * 60 * 60);


So, other messages can start processing without waiting for the above method.

Unfortunately, this is not available for Publications(subscriptions) for no reason. But now you can possible it with this project.

Usage

Install following package into your Meteor app.

or add meteorhacks:unblock

or older Meteor versions
add unblock

Use it inside your publications, if that takes too much time or you don't need subscriptions from other publications to wait on this.

or.publish('myLongPublications', function() {
is.unblock(); //yeah!
teor._sleepForMs(1000 * 60 * 60);


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.