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

gitFittest & gitAverage are sync functions calling async ones. #211

Closed
missionz3r0 opened this issue Mar 27, 2020 · 3 comments
Closed

gitFittest & gitAverage are sync functions calling async ones. #211

missionz3r0 opened this issue Mar 27, 2020 · 3 comments

Comments

@missionz3r0
Copy link

missionz3r0 commented Mar 27, 2020

As a precursor, I'm willing to make these changes myself. But want to make sure there is not a reason for these functions to be the way they are before doing so.

Description

In neat:

getFittest and getAverage both call the async method evaluate while being sync methods. This causes unexpected behavior when calling getFittest or getAverage. Seems this was an issue back in neataptic too.

See wagenaartje/neataptic#137
and wagenaartje/neataptic#100

Files

You can see the function I am talking about here.

To Reproduce

Just call getFittest, or getAverage.

Tasks

Include specific tasks in the order they need to be done in. Include links to specific lines of code where the task should happen at.

  • Make getFittest async, and have it await the evaluate function
  • Make getAverage async, and have it await the evaluate function
missionz3r0 pushed a commit to missionz3r0/carrot that referenced this issue Mar 27, 2020
Made getFittest and getAverage async, and added appropriate awaits.
@missionz3r0 missionz3r0 mentioned this issue Mar 27, 2020
@christianechevarria
Copy link
Member

@missionz3r0 thanks for writing such a well articulated issue; this was an issue that we noted but seemed to slip through the cracks as we were working on the codebase. I'll merge your PR now 👍

christianechevarria added a commit to missionz3r0/carrot that referenced this issue Mar 27, 2020
christianechevarria pushed a commit that referenced this issue Mar 27, 2020
Made getFittest and getAverage async, and added appropriate awaits.
@missionz3r0
Copy link
Author

@christianechevarria Thank you very much.

It was something I noticed in neataptic a couple days ago before I realized Carrot was a thing. Was surprised when the same issue was over here as well. Though, if not for the issue in neataptic I would not have known carrot was a thing. So all is well that ends well.

@christianechevarria
Copy link
Member

@missionz3r0 Welcome to the community then! 😄 We have a few projects going on, as of late we are working to refactor the library and migrate to TS to make it more maintainable in preparation to add more features + new algo implementations

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

No branches or pull requests

2 participants