-
Notifications
You must be signed in to change notification settings - Fork 97
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
doseHistory restore from poolState.json #358
Comments
This is what the call returns: And this is how it's in the dashboard: Please see attached the backup as well: And this is how the poolState.json looked before I restarted the njPC As for the log files, I see that they are generated, but they are not read - I added breakpoints in the code and they don't seem to be read |
Not relevant here but I think there is a bug because in my setup the code in controller/State.ts
In never hit, I guess this is not triggered by:
The save of doseHistory is performed when other elements are set/reset |
No the setter is not called by calling the getter while chaining a this.doseHistory.unshift(dose). The unshift is simply adding a dose to the beginning of the array. We are using proxies for the underlying data so it looks a lot more complicated than it is. This allows us to track changes to the data without beating up any interfaces or sockets. Are you sure the trigger for this clearing of data happens during startup? Oddly I see that it successfully calculated a 24 hour dosage but the individual records are 0. There is no way it is summing this up to get a number other than 0. |
The 24h calculation doesn't seem to be related to the doseHistory - I can clear the history, restart njPC and the 24h calculation is still calculated - I didn't check the numbers if they are right or not. I did another test - this time I pointed the dashboard to another njPC instance and pointed njPC to a bad host/port - to not receive messages
I'm 99% sure that this is the root cause, but I can't explain why - I guess the threading or something. |
I also backed out the changes in pull #359 just to be 100% sure it's not my changes - same behavior |
Ok so I looked closer at this and the problem has to be that the incoming data is not being parsed on initial startup. Which is why it is hitting the default initializers. What I would like you to do is stop njsPC then restore your poolState.json with the correct values and restart njsPC. While it is starting up if it has some odd values we should see some obvious DataLogger error messages in the console. So pull njsPC by going to the nodejs-poolController directory and type Then restart njsPC and watch the console for messages related to the datalogger. I put a bunch of asterisks on these messages so they should be apparent. |
ChemicalDoseState is a derived class of DataLoggerEntry. On line 417 or so you will see a line like
Add a console.log(this); right after that statement. Then lets see what it outputs. Just to be sure what version of node are you running? |
I noticed the same issue on |
Well I'm not a docker user but I do know that node 16 hasn't even started active LTS support until the 26th and I am currently running 12 as 14 had serial port issues as well. Something may be up with the extend libraries and node still. |
I just used your Dockerfile, updated the base image from I'm 99% sure that you should reproduce the issue is you put my json file - if you need I can send you a more recent one. |
But your after parse code shows that it parsed correctly. I guess I do not understand that it worked before you ran docker compose but after that it fails to parse. What is "this container". Honestly, I do not have a handle on docker but the most likely failure mode is that it failed to parse or the extend library failed to set the properties from the parsed object. |
The poolState.json is still valid if I start and stop the njsPC - but If I make the API call then exit - the bad data is getting saved. See attached I don't have an explanation either, unless one of the dependent libraries is a different version - see attached the package-lock file |
Which endpoint are you calling? There are several that probably need some work for IntelliChem. I assumed you were calling GET /state/chemController/1/doseHistory. Is that correct. |
You are correct, I'm using GET /state/chemController/1/doseHistory for testing. I'm not building/using a new client or something. I'm using the dashPanel - but I figured it's a simpler test case if you make the API call. |
What is really interesting here is that dashPanel is calling that exact endpoint when you click on the 24 hour dose list. That being said there were some similar endpoints using a search verb on the api. I moved these from doseHistory to doseLog. That being said I performed the exact steps. I replaced my doseHistory with yours called the api That being said I moved the other verbs around to see if there is something weird with the express routing. Pull njsPC and lets see if the other routes which are using TS templates were in the way. If you want to try the route call This will turn out to be something really simple. |
I pulled the new code and tested: |
Just to be sure. Is this after you shut down njsPC then put the doseHistory back correctly into the poolState.json. Here are the steps I expected.
|
I performed all the steps, step #4 failed - bad results here. If you want you can reach out to me directly at snagytx81 On Gmail and we can setup a remote debug session - I'm a developer as well and I have all that I need to debug and update the code. |
My availability is going to be very limited until the end of next week. However, in the meantime can I get you to make the edits to the poolState.json and then upload them here? When I get some time I will step it through the debugger. |
This is the poolState.txt file that I use. I just change the I'm available most of the day, CST, ping me and we can schedule a remote session when it's convenient to both of us. |
I can replicate this. I'll step through it tomorrow or over the weekend... should be easy for me to track down. |
I need @rstrouse's help to look at this. I see exactly where it is happened, but sitting here scratching my head. He may be out of town for the week... will get back with you soon. |
Exactly, I’m a developer for 15 years - other languages, and theoretically what I see makes no sense, super call to not pass this text to the extending class. |
I should have this fixed. Please check it out. There were 2 issues at hand.
|
It seems that the changes you did resolved the problem. I'll keep an eye on the system. |
Hello,
I'm not a TS developer but I can know enough to debug the code. It seems that when the doseHistory is restored from the json file, something is incorrect - all the elements are restored with 0 value.
This is the troubleshooting that I did:
Added a console.log in the DataLoggerEntry constructor as seen in the screenshot:
![image](https://user-images.githubusercontent.com/10343781/138101930-451f078d-4763-48e3-baf0-b2f28fbe8a4f.png)
This is the console.log output:
![image](https://user-images.githubusercontent.com/10343781/138101773-48ce97f4-76a1-4789-8724-67b735d600e4.png)
When it returns to ChemicalDoseState, which calls the above code in the super, the
![image](https://user-images.githubusercontent.com/10343781/138101859-ea482ebe-562a-4a0a-ab7a-a9849e00ab29.png)
this
object is still empty and the element values are not transferred from the extended class:I'm not really sure why this happens. Maybe this is something basic that I'm missing.
The issue is really easy to reproduce.
I'm using an IntelliChem as a chemContoller and using the latest source code from git.
This is my ph doseHistory section:
The text was updated successfully, but these errors were encountered: