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

Started with async/await/promise and hapi v17 migration #68

Merged
merged 15 commits into from
May 22, 2019
Merged

Started with async/await/promise and hapi v17 migration #68

merged 15 commits into from
May 22, 2019

Conversation

paazmaya
Copy link
Contributor

@paazmaya paazmaya commented Apr 1, 2019

Started with library upgrade which ended up getting more using async/await and so forth...

@paazmaya paazmaya changed the title WIP: Started with async/await/promise and hapi v17 migration Started with async/await/promise and hapi v17 migration Apr 2, 2019
@paazmaya
Copy link
Contributor Author

Anyone interested? Maybe @hollsk since this person seems to be the one making most latest merges....

@paazmaya
Copy link
Contributor Author

@hollsk this PR is again up to date against master, any change of taking a look?

Copy link
Member

@joeyciechanowicz joeyciechanowicz left a comment

Choose a reason for hiding this comment

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

Absolutely fantastic work @paazmaya. This is really great!

One comment on the PR as a whole is that it introduces async functions and uses await nicely. However the models (mainly) still rely on directly using promises and returning them, as well as handling errors within them. IMO it would be best to adopt a singular style across the codebase. Which for me would be async/await. Though it would be good to get others opinions on this.

There may also be a broader discussion about using a logging library that can handle things like logging debug messages in development etc.

model/task.js Outdated Show resolved Hide resolved
model/task.js Outdated Show resolved Hide resolved
return reply().code(500);
handler: async function(request, reply) {

const task = await model.task.getById(request.params.id);
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to handle the error logging in our model, or here in the route?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No idea. Perhaps I could work on those in a separate PR...

Copy link
Member

Choose a reason for hiding this comment

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

I think that would make sense. We generally want to tackle logging a bit within the web-services. Theres a number of .code(500) responses without any further information for the client.

app.js Show resolved Hide resolved
@paazmaya
Copy link
Contributor Author

@joeyciechanowicz there might be issues still from the merge yesterday, since there were plenty of conflicts, hence some lines might have re-apperred, such as the use of async module, which was already removed earlier in this PR...

@paazmaya
Copy link
Contributor Author

Now I remember, I did not want to touch them until MongoDB would be updated, and I did not want to do it in this PR, specially when I noticed the last of interest in early April...

@paazmaya
Copy link
Contributor Author

After this PR, there is still version cap in these two major modules:

  • hapi ~17.0 → ~18.1
  • mongodb ~2.2.19 → ~3.2.4

@paazmaya
Copy link
Contributor Author

@joeyciechanowicz how to proceed?

@joeyciechanowicz
Copy link
Member

More amazing work @paazmaya. There is an issue for the 500 responses #70 which can be expanded to generally improve logging. Though I think this PR goes a long way towards that and does fix some of the previously bad 500's

@joeyciechanowicz joeyciechanowicz merged commit 2d8a9a0 into pa11y:master May 22, 2019
@paazmaya paazmaya deleted the migrate-async-and-hapi-v17 branch May 22, 2019 14:20
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.

None yet

2 participants