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

verify action IDs #519

Merged
merged 85 commits into from
Nov 12, 2021
Merged

verify action IDs #519

merged 85 commits into from
Nov 12, 2021

Conversation

patriciojofre
Copy link
Member

@patriciojofre patriciojofre commented Oct 14, 2021

Major modifications on storage logic for commands, files, geofencing, triggers, etc.

Copy link
Member Author

@patriciojofre patriciojofre left a 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

@javo @JohaoRosasRosillo

lib/agent/actions.js Outdated Show resolved Hide resolved
@@ -39,6 +39,7 @@ var action_running = function(type, action, name, opts, emitter) {
watch_action_events(action.events, emitter);
}

// revisar q hace esta funcion!
Copy link
Contributor

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?


emitter.once('end', function(err, out) {
emitter.once('end', function(id, err, out) {
if (err) hooks.trigger('error', err);

logger.info('Stopped: ' + name);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logger.info('Stopped: ' + name);
logger.info(`Stopped: ${name}`);

lib/agent/actions.js Outdated Show resolved Hide resolved
lib/agent/actions.js Outdated Show resolved Hide resolved
lib/agent/actions.js Outdated Show resolved Hide resolved
@@ -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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// "date": "" + (new Date().getFullYear() +1) + "0725150007"

test/lib/agent/actions/triggers.js Outdated Show resolved Hide resolved
Comment on lines 379 to 382
// 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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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;

test/lib/agent/actions/triggers.js Outdated Show resolved Hide resolved
test/lib/agent/updating_spec.js Outdated Show resolved Hide resolved
JohaoRosasRosillo and others added 14 commits November 11, 2021 14:05
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]>
Copy link

@jll90 jll90 left a 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!

lib/agent/actions.js Outdated Show resolved Hide resolved
@@ -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) => {
Copy link

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)
Copy link

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.

Copy link
Member Author

@patriciojofre patriciojofre left a 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)

lib/agent/commands.js Outdated Show resolved Hide resolved
@@ -37,7 +37,6 @@ function main() {
}
Main(options, function(err) {
if (err) {
console.error(err);
Copy link
Contributor

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

este tb

@@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

este tb es necesario

@javo javo merged commit 8b4b087 into master Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants