Skip to content

Refactor examples.js to use async/await #1694

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

Merged
merged 7 commits into from
Dec 4, 2020
Merged

Refactor examples.js to use async/await #1694

merged 7 commits into from
Dec 4, 2020

Conversation

Swapnil-2001
Copy link
Contributor

@Swapnil-2001 Swapnil-2001 commented Nov 25, 2020

Fixes #1693

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • is from a uniquely-named feature branch and has been rebased on top of the latest develop branch. (If I was asked to make more changes, I have made sure to rebase onto develop then too)
  • is descriptively named and links to an issue number, i.e. Fixes #123

@catarak please let me know if the changes are okay.

@catarak
Copy link
Member

catarak commented Nov 25, 2020

Thanks for working on this! Your changes look great. One thing I would also suggest changing is the reliance on the library async (and the function eachSeries) which is used to make using callback functions easier. I believe you could get rid of it and just use the library q!

@Swapnil-2001
Copy link
Contributor Author

Okay, I'll be changing that!

@Swapnil-2001
Copy link
Contributor Author

Could you please go through the changes? This is my first time working with the library q so I'm not 100% sure!

@catarak
Copy link
Member

catarak commented Dec 2, 2020

Looking at this again, I also noticed that the mongoose queries (e.g. User.findOne) use callbacks—could these use async/await as well?

@Swapnil-2001
Copy link
Contributor Author

Swapnil-2001 commented Dec 3, 2020

Of course!

Also, I replaced remove with deleteOne, since remove is deprecated.

@catarak catarak merged commit 85c8441 into processing:develop Dec 4, 2020
@Swapnil-2001 Swapnil-2001 deleted the async-await-refactor branch December 16, 2020 15:51
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.

Refactor fetch-examples script to only use async/await
2 participants