Skip to content

Instantly share code, notes, and snippets.

View uxdiogenes's full-sized avatar

Diogenes Brito uxdiogenes

View GitHub Profile
@uxdiogenes
uxdiogenes / condition.sample.json
Created September 20, 2015 00:47
Example Condition
{
"resourceType":"Bundle",
"id":"79764283-7b46-4a30-af5b-7216d3e08513",
"meta":{
"lastUpdated":"2015-09-19T20:46:38.674-04:00"
},
"type":"searchset",
"base":"http://polaris.i3l.gatech.edu:8080/gt-fhir-webapp/base",
"total":1,
"link":[
@uxdiogenes
uxdiogenes / encounter.sample.json
Created September 20, 2015 00:45
Example Encounter
{
"resourceType":"Bundle",
"id":"f284421b-3e2e-4efc-b24f-e1b28777afb1",
"meta":{
"lastUpdated":"2015-09-19T20:44:36.655-04:00"
},
"type":"searchset",
"base":"http://polaris.i3l.gatech.edu:8080/gt-fhir-webapp/base",
"total":1,
"link":[
@uxdiogenes
uxdiogenes / patient.sample.json
Created September 20, 2015 00:41
Example Patient Data
{
"resourceType":"Bundle",
"id":"00592678-acf4-4485-88f9-abb8569b39aa",
"meta":{
"lastUpdated":"2015-09-19T20:39:44.225-04:00"
},
"type":"searchset",
"base":"http://polaris.i3l.gatech.edu:8080/gt-fhir-webapp/base",
"total":1,
"link":[

From Meteor's documentation:

In Meteor, your server code runs in a single thread per request, not in the asynchronous callback style typical of Node. We find the linear execution model a better fit for the typical server code in a Meteor application.

This guide serves as a mini-tour of tools, trix and patterns that can be used to run async code in Meteor.

Basic async

Sometimes we need to run async code in Meteor.methods. For this we create a Future to block until the async code has finished. This pattern can be seen all over Meteor's own codebase:

#! /bin/sh
# ------------------------------------------------------------------------------
# SOME INFOS : fairly standard (debian) init script.
# Note that node doesn't create a PID file (hence --make-pidfile)
# has to be run in the background (hence --background)
# and NOT as root (hence --chuid)
#
# MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit
# INIT-INFO RULES http://wiki.debian.org/LSBInitScripts
# INSTALL/REMOVE http://www.debian-administration.org/articles/28