Skip to content

Commit

Permalink
v4.0.0 Call the callback when http is listening (don't block until de…
Browse files Browse the repository at this point in the history
…ath)
  • Loading branch information
royvandewater / virgilvox committed Jan 10, 2017
1 parent cf3f5e7 commit bd44795
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 9 deletions.
135 changes: 135 additions & 0 deletions coffeelint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
{
"arrow_spacing": {
"level": "ignore"
},
"braces_spacing": {
"level": "ignore",
"spaces": 0,
"empty_object_spaces": 0
},
"camel_case_classes": {
"level": "error"
},
"coffeescript_error": {
"level": "error"
},
"colon_assignment_spacing": {
"level": "ignore",
"spacing": {
"left": 0,
"right": 0
}
},
"cyclomatic_complexity": {
"value": 10,
"level": "warn"
},
"duplicate_key": {
"level": "error"
},
"empty_constructor_needs_parens": {
"level": "ignore"
},
"ensure_comprehensions": {
"level": "warn"
},
"eol_last": {
"level": "ignore"
},
"indentation": {
"value": 2,
"level": "error"
},
"line_endings": {
"level": "ignore",
"value": "unix"
},
"max_line_length": {
"value": 180,
"level": "error",
"limitComments": true
},
"missing_fat_arrows": {
"level": "ignore",
"is_strict": false
},
"newlines_after_classes": {
"value": 3,
"level": "ignore"
},
"no_backticks": {
"level": "error"
},
"no_debugger": {
"level": "warn",
"console": false
},
"no_empty_functions": {
"level": "ignore"
},
"no_empty_param_list": {
"level": "ignore"
},
"no_implicit_braces": {
"level": "ignore",
"strict": true
},
"no_implicit_parens": {
"strict": true,
"level": "ignore"
},
"no_interpolation_in_single_quotes": {
"level": "ignore"
},
"no_nested_string_interpolation": {
"level": "warn"
},
"no_plusplus": {
"level": "ignore"
},
"no_private_function_fat_arrows": {
"level": "warn"
},
"no_stand_alone_at": {
"level": "ignore"
},
"no_tabs": {
"level": "error"
},
"no_this": {
"level": "ignore"
},
"no_throwing_strings": {
"level": "error"
},
"no_trailing_semicolons": {
"level": "error"
},
"no_trailing_whitespace": {
"level": "error",
"allowed_in_comments": false,
"allowed_in_empty_lines": true
},
"no_unnecessary_double_quotes": {
"level": "ignore"
},
"no_unnecessary_fat_arrows": {
"level": "ignore"
},
"non_empty_constructor_needs_parens": {
"level": "ignore"
},
"prefer_english_operator": {
"level": "ignore",
"doubleNotLevel": "ignore"
},
"space_operators": {
"level": "ignore"
},
"spacing_after_comma": {
"level": "ignore"
},
"transform_messes_up_line_numbers": {
"level": "warn"
}
}
3 changes: 1 addition & 2 deletions command.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ sigtermHandler = new SigtermHandler({ events: ['SIGTERM', 'SIGINT'] })
sigtermHandler.register meshbluCoreRunner.stop

meshbluCoreRunner.catchErrors()

meshbluCoreRunner.on 'error', (error) -> throw error
meshbluCoreRunner.prepare (error) =>
if error
meshbluCoreRunner.reportError error
Expand All @@ -268,4 +268,3 @@ meshbluCoreRunner.prepare (error) =>
meshbluCoreRunner.reportError error
console.error error.stack
process.exit 1
process.exit 0
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meshblu-server",
"version": "3.1.4",
"version": "4.0.0",
"description": "A bundled version of meshblu-core",
"main": "index.js",
"repository": {
Expand Down
15 changes: 9 additions & 6 deletions src/meshblu-core-runner.coffee
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
async = require('async')
{EventEmitter} = require 'events'
DispatcherWorker = require('meshblu-core-dispatcher')
MeshbluHttp = require('meshblu-core-protocol-adapter-http')
WebhookWorker = require('meshblu-core-worker-webhook')
debug = require('debug')('meshblu:meshblu-core-runner')

class MeshbluCoreRunner
class MeshbluCoreRunner extends EventEmitter
constructor: (options) ->
@dispatcherWorker = new DispatcherWorker options.dispatcherWorker
@meshbluHttp = new MeshbluHttp options.meshbluHttp
Expand Down Expand Up @@ -32,10 +33,12 @@ class MeshbluCoreRunner

run: (callback) =>
debug '->run'
async.parallel [
@meshbluHttp.run,
@dispatcherWorker.run,
@webhookWorker.run,
], callback
@dispatcherWorker.run (error) =>
@emit 'error', error if error?

@webhookWorker.run (error) =>
@emit 'error', error if error?

@meshbluHttp.run callback

module.exports = MeshbluCoreRunner

0 comments on commit bd44795

Please sign in to comment.