Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start on message visibility heartbeat #209

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 40 additions & 19 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,24 +1,45 @@
{
"rules": {
"indent": [2, 2],
"quotes": [2, "single"],
"quote-props": [2, "as-needed"],
"no-console": [1],
"semi": [2, "always"],
"space-before-function-paren": [2, "never"],
"object-curly-spacing": [2, "always"],
"array-bracket-spacing": [2, "never"],
"comma-spacing": [2, { "before": false, "after": true }],
"key-spacing": [2, { "beforeColon": false, "afterColon": true }]
},
"extends": "eslint:recommended",
"env": {
"node": true,
"es6": true
"node": true,
"es6": true,
"jest": true
},
"globals": {
"process": true,
"module": true,
"require": true
"parserOptions": {
"ecmaVersion": "2017"
},
"extends": "eslint:recommended"
"plugins": [
"node"
],
"rules": {
"arrow-parens": ["error", "always"],
"no-var": "error",
"prefer-const": "error",
"array-bracket-spacing": ["error", "never"],
"comma-dangle": ["error", "never"],
"computed-property-spacing": ["error", "never"],
"eol-last": "error",
"eqeqeq": ["error", "smart"],
"indent": ["error", 2, { "SwitchCase": 1 }],
"no-confusing-arrow": ["error", {"allowParens": false}],
"no-extend-native": "error",
"no-mixed-spaces-and-tabs": "error",
"no-spaced-func": "error",
"no-trailing-spaces": "error",
"no-unused-vars": "error",
"no-use-before-define": ["error", "nofunc"],
"object-curly-spacing": ["error", "always"],
"prefer-arrow-callback": "error",
"quotes": ["error", "single", "avoid-escape"],
"semi": ["error", "always"],
"space-infix-ops": "error",
"spaced-comment": ["error", "always"],
"keyword-spacing": ["error", { before: true, after: true }],
"template-curly-spacing": ["error", "never"],
"semi-spacing": "error",
"strict": "error",
"no-console": "off",
"node/no-unsupported-features": ["error", {"version": 8}],
"node/no-missing-require": "error"
}
}
7 changes: 1 addition & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
cache: apt
language: node_js
node_js:
- '4'
env:
global:
- secure: Pn+WVEuDcuNlUia2ehSAgH5wdWlBdSDVXYSjzAoBJO9oPotrfLSN26Lu+gOTXyJ92h99vwN00osQyw7cqGYrX2dO2nu0JfVhIZ99iXJmjRnWQvkf0DcE6RsxcL1bIRYtlJlQMr2sS2zJ7owUAzX7EFpOvurT0EeuB3IQg5bwhoy3nTJuwxg7XWJ9wWHyFSXAieTfyODw3LGemmtZjTe0K5Vu07VQkph0MMohWF64dXptEE99Df6LumMQ4u6RTczayih7EXWwXRvDzw4r1AUQKBkAa767vpg3UelWb6mHKwhl6GpjXiaW8qlfIszyFyHU8Dc454wagd3VhPG4UxdZUdnV8hjd79Ak1bKubjlo9ZgxZAYqT11+g6UNZ2bmO8hLsnvvXbxWmZ0I81lf5iCkzPhqOLoIVyfQs8aINrmfqoqCMgwKlzoT+cda6v/5kxzG9UO9Hmhm2XhHMAleo36rRw+a0x9yNtCU8qVrmEVIyxVMvzsdDm8/pAUCyzUd042rCH1YAzRvk2Lb39nbNW4gGaJKghvjOF9iAB4QisyqfvnmTN7JvIL1M5EdAJaa86XROFTfUlPoTaLyGeztGWNQpzry4IqNBQFBrzvPrw0gnP9eUWRPxtttZFK/2GOS7sZT7MaFOpZ4w6YcaR9VrviqryepYM8eluA7EDqkrSUpCrs=
- secure: Pk6fpHDyWPwh8Zek++MA5Q4aVZzQGOjh7Tz5LD4UN+g31CY7EGQ1nivIhVQLQKlS/4H18VXYew3wyxKDmec7Iwz2GqCj2ZDTVCXQG2ITGA6BB3NJ5Ei0C0Ah12Vv5sHlPTCo8UhkpTBNt6ytEV1CWhotY+WajIIEm4HN3PgmpX+tam4cPEUezK+ScJH8xhQCuQqow42T47hSXvkPUu17tMaZfhGLCGX3fKzcEoFYiqdHIbKxSaQ//uRVbXWcSHgsNsA1nFHUgemJC1lH2o02uAdtZuMQ+JyIsQY1nMamsgCv3JpGlgSaIrt6wiJX1ipJOmtRH8L5fRmWgFKsCXDSo6oMfE8arMF1vED6AhTWlv3Kb5v1boehNwgheSxLLvHESP7T0wsc77nNybpnUSV8bOJ3bfPknES3YoGcyffPyu4Xi/MG7ibGvd9B/OnmysZyHinBkb9JI7X1paAVW2RQgEXm0sx0rkqO74N7vEFAfxlU+GgN12AAq79pKUCRMIOXKjB9lZFQnYXmTa1H/CyNE//gdHBLdZGSjHMpJ8N0+tww0SIQo1FHhJmJH0/p5heZJRzTARfVtRGsbEH7+W/5IUTtW10YtGWYtKAS+8S3cD6WIfrm20jZaFbk9clmW/n4WRB0y2s5LxwPF4sNStZRJDhn0ozrcM1IRVJz4r/rdik=
- '8'
26 changes: 0 additions & 26 deletions Dockerfile

This file was deleted.

23 changes: 0 additions & 23 deletions bin/bootstrap.sh

This file was deleted.

44 changes: 0 additions & 44 deletions bin/cli.js

This file was deleted.

20 changes: 0 additions & 20 deletions bin/watchbot-log.js

This file was deleted.

8 changes: 0 additions & 8 deletions bin/watchbot-progress.sh

This file was deleted.

61 changes: 29 additions & 32 deletions bin/watchbot.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
#!/usr/bin/env node

var fastlog = require('fastlog')('watchbot');
var _ = require('underscore');
var sendNotification = require('../lib/notifications')(process.env.NotificationTopic).send;
var watchbot = require('..');

var required = [
'Cluster',
'TaskDefinition',
'Concurrency',
'QueueUrl',
'TaskEventQueueUrl',
'NotificationTopic',
'StackName',
'LogGroupArn',
'AlarmOnEachFailure'
];

var missing = _.difference(required, Object.keys(process.env));
if (missing.length) {
var err = new Error('Missing from environment: ' + missing.join(', '));
fastlog.error(err);
sendNotification('[watchbot] config error', err.message);
process.exit(1);
}

/**
* The main Watchbot loop. This function runs continuously on one or more containers,
* each of which is responsible for polling SQS and spawning tasks to process
* messages, while maintaining a predefined task concurrency and reporting any failed
* processing tasks.
*/
watchbot.main(process.env);
'use strict';

const Watcher = require('../lib/watcher');
const Logger = require('../lib/logger');

const main = async () => {
if (process.argv[2] !== 'listen')
throw new Error(`Invalid arguments: ${process.argv.slice(2).join(' ')}`);

const logger = Logger.create('watcher');
const command = process.argv.slice(3).join(' ');

const options = {
queueUrl: process.env.QueueUrl,
workerOptions: { command }
};

const watcher = Watcher.create(options);

try {
await watcher.listen();
} catch (err) {
logger.log(`[error] ${err.stack}`);
}
};

module.exports = main;

if (require.main === module) main();
36 changes: 0 additions & 36 deletions cloudformation/ci.template.js

This file was deleted.

55 changes: 0 additions & 55 deletions docs/alarms.md

This file was deleted.

Loading