Skip to content

Comments

Feature event accept array#311

Merged
DeviaVir merged 11 commits intomotdotla:masterfrom
abetomo:feature_event_accept_array
Jun 8, 2017
Merged

Feature event accept array#311
DeviaVir merged 11 commits intomotdotla:masterfrom
abetomo:feature_event_accept_array

Conversation

@abetomo
Copy link
Contributor

@abetomo abetomo commented Jun 8, 2017

It is a fix of #283.

Please point out if there is something about the following two points.

  • I reused the existing --eventFile, but should I use another option?
  • I adopted a method to execute node-lambda run internally, but is it better to do another way?

Copy link
Collaborator

@DeviaVir DeviaVir left a comment

Choose a reason for hiding this comment

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

👍 just some nits

lib/main.js Outdated
console.log(`!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
The event received by AWS Lambda is basically Object.
For \`node-lambda\`, if event.json is an array,
constit is treated as multiple events and run multiple times.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would write it as:

Usually you will receive a single Object from AWS Lambda.
We added support for event.json to contain an array,
so you can easily test run multiple events.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you!

lib/main.js Outdated
return _argv.indexOf('--eventFile')
})()

// In order to reproduce the movement of callbackWaitsForEmptyEventLoop,
Copy link
Collaborator

Choose a reason for hiding this comment

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

the movement => the logic?

abetomo added 2 commits June 8, 2017 19:34
the movement ->
the logic
@DeviaVir DeviaVir merged commit 73cfd08 into motdotla:master Jun 8, 2017
const context = require(path.join(process.cwd(), program.contextFile))

this._runHandler(handler, event, program, context)
if (Object.prototype.toString.call(event) !== '[object Array]') {
Copy link

Choose a reason for hiding this comment

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

Why not Array.isArray()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you! I'll try!

@demian85
Copy link

demian85 commented Jun 8, 2017

Are those events run in order? Would be awesome!

@abetomo
Copy link
Contributor Author

abetomo commented Jun 8, 2017

@demian85
Since it is asynchronous processing, the order of execution is not guaranteed.
Do you want to modify it to run in order?

@demian85
Copy link

demian85 commented Jun 8, 2017

Yes I can do that later, don't have time today. Perhaps tomorrow or this weekend. Thanks.

@abetomo
Copy link
Contributor Author

abetomo commented Jun 8, 2017

@demian85
I modified to synchronous processing and opened the PR(#313).

@abetomo abetomo deleted the feature_event_accept_array branch June 9, 2017 14:55
@DeviaVir DeviaVir mentioned this pull request Jun 16, 2017
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.

3 participants