TheThingsNetwork / lorawan-devices

Device Repository for LoRaWAN devices
Apache License 2.0
184 stars 360 forks source link

Update validation.js (and comments) #726

Closed LDannijs closed 6 months ago

LDannijs commented 6 months ago

Summary

Picking up #633 to fix the comments in response to @KrishnaIyer

johanstokking commented 6 months ago

What is the problem that we're trying to solve here?

LDannijs commented 6 months ago

@KrishnaIyer asked me to take over that PR and to update the comments so. Or did you mean the validate itself?

LDannijs commented 6 months ago

Whoops that mention was an accident

johanstokking commented 6 months ago

What is the problem this pull request is trying to solve?

LDannijs commented 6 months ago

Running the validation very often results in an EAGAIN error. I do not know the details of it, only that it is a memory issue, but this fixes it by slowing the process down and other fixes (read Jaime's original PR for full details).

johanstokking commented 6 months ago

Running the validation very often results in an EAGAIN error. I do not know the details of it, only that it is a memory issue, but this fixes it by slowing the process down and other fixes (read Jaime's original PR for full details).

Do you encounter this yourself? Are there reports from users?

LDannijs commented 6 months ago

I encounter it everytime i run it, and users also often do.

Jaime-Trinidad commented 6 months ago

Many users seem to be encountering this issue. I believe the following code could provide a temporary solution, though it may slow down the process. It still occasionally encounters an EAGAIN error, and I haven't fully grasped the underlying cause yet, especially since it doesn't appear to use all the available memory on my end. Interestingly, this issue has never occurred on my VM running Ubuntu.

Additionally, it's important to note that error and close are mutually exclusive in this code. The code is designed to promise only one outcome: if an error occurs, it rejects the promise. On a successful close, the promise is resolved. However, if it closes with issues, the promise is also rejected.

LDannijs commented 6 months ago

So i decided to at least give it a shot and run the feedback through ChatGPT and it seems it runs really well now. It's now running through it sequentially and it's not giving me any errors. Hope this is what we're looking for.

@Jaime-Trinidad please take a look as well.