-
Notifications
You must be signed in to change notification settings - Fork 76
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
verify action IDs #519
verify action IDs #519
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- delete all console.logs.
- test behavior of verify_if_exist_id function. this function is the core of this PR.
- maybe rename storage2 to more descriptive name
lib/agent/actions.js
Outdated
@@ -39,6 +39,7 @@ var action_running = function(type, action, name, opts, emitter) { | |||
watch_action_events(action.events, emitter); | |||
} | |||
|
|||
// revisar q hace esta funcion! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Es necesario que quede ese comentario?
lib/agent/actions.js
Outdated
|
||
emitter.once('end', function(err, out) { | ||
emitter.once('end', function(id, err, out) { | ||
if (err) hooks.trigger('error', err); | ||
|
||
logger.info('Stopped: ' + name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.info('Stopped: ' + name); | |
logger.info(`Stopped: ${name}`); |
@@ -65,7 +66,8 @@ var exact_triggers = [ | |||
{ | |||
"type": "exact_time", | |||
"info": { | |||
"date": "" + (new Date().getFullYear() +1) + "0725150007" | |||
"date": "20301015183411" | |||
// "date": "" + (new Date().getFullYear() +1) + "0725150007" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// "date": "" + (new Date().getFullYear() +1) + "0725150007" |
test/lib/agent/actions/triggers.js
Outdated
// timezone_offset = new Date().getTimezoneOffset() * 60 * 1000, | ||
// new_date = new Date(Date.UTC(2019, 11, 20, 11, 55, 05)).getTime() + timezone_offset; | ||
// console.log("NEW DATE!!", new_date) | ||
// new_date = 1574261705000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// timezone_offset = new Date().getTimezoneOffset() * 60 * 1000, | |
// new_date = new Date(Date.UTC(2019, 11, 20, 11, 55, 05)).getTime() + timezone_offset; | |
// console.log("NEW DATE!!", new_date) | |
// new_date = 1574261705000; |
Co-authored-by: Seba Pinto-Agüero González <[email protected]>
Co-authored-by: Seba Pinto-Agüero González <[email protected]>
Co-authored-by: Seba Pinto-Agüero González <[email protected]>
Co-authored-by: Seba Pinto-Agüero González <[email protected]>
Co-authored-by: Seba Pinto-Agüero González <[email protected]>
Co-authored-by: Seba Pinto-Agüero González <[email protected]>
Co-authored-by: Seba Pinto-Agüero González <[email protected]>
Co-authored-by: Seba Pinto-Agüero González <[email protected]>
Co-authored-by: Seba Pinto-Agüero González <[email protected]>
Co-authored-by: Seba Pinto-Agüero González <[email protected]>
Co-authored-by: Seba Pinto-Agüero González <[email protected]>
Co-authored-by: Seba Pinto-Agüero González <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deje comentarios pero thumbs up!
@@ -36,6 +37,33 @@ var path_arg, | |||
// check_pending_files is used to resume any files that might been pending. It's called from | |||
// filesagent/providers/network. | |||
|
|||
var run_stored = (host, cb) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seria bueno por temas de estandares pasar todas las variables que estan en snake_case
a camelCase
. Entiendo que es algo que se puede ir haciendo poco a poco.
@@ -88,25 +120,44 @@ exports.start = function(options, cb) { | |||
return; | |||
} | |||
if (res.statusCode == 404) { | |||
files.del(options.file_id); | |||
logger.debug('Removing file_id from DB: ' + options.file_id); | |||
storage.do('del', { type: 'files', id: options.file_id }); | |||
return; | |||
} | |||
var data = JSON.parse(res.body); | |||
var file_status = JSON.parse(res.body).Status | |||
options.total = data.Total; | |||
|
|||
if (file_status == 0 || file_status == 4) { // File in progress(0) or Pending(4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Es preferible usar el ===
en JS, pero hay que tener cuidado si se hace este cambio.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coincido con @sebapintoag @jll90 en:
- manejo de try / catch: utilizar la variable
e
para enviar la excepción a algun lado y saber qu está ocurriendo un error (bugsnag/exceptions) - comentarios en inglés o español
- snakeCase en lo posible (o para este PR, pero para el siguiente sería ideal)
@@ -37,7 +37,6 @@ function main() { | |||
} | |||
Main(options, function(err) { | |||
if (err) { | |||
console.error(err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tb regresalo
@@ -89,7 +88,6 @@ function upload_file(file, buf, cb) { | |||
|
|||
needle.post(url, buf, options, function(err, res) { | |||
if (err) { | |||
console.log(err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
este tb
lib/agent/actions/wipe/runner.js
Outdated
@@ -23,7 +23,6 @@ wipe.fetch_dirs(what, to_erase, to_kill, null, (err) => { | |||
if (err) last_err = err; | |||
wipe.wipeout((err, out) => { | |||
if (err) last_err = err; | |||
console.log(out) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
este tb es necesario
Major modifications on storage logic for commands, files, geofencing, triggers, etc.