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

Do not store duplicate charging sessions and connector status #81

Closed
goRaspy opened this issue Jul 19, 2018 · 8 comments
Closed

Do not store duplicate charging sessions and connector status #81

goRaspy opened this issue Jul 19, 2018 · 8 comments

Comments

@goRaspy
Copy link

goRaspy commented Jul 19, 2018

In certains circonstances, charging station will send OCPP message twice.

For example, with a GPRS data connection, we can have a best connectivity for Cell to chargepoint way and a less good connectivity for the chargepoint to cell canal.

So in this case, it may happen that the chargepoint will send ( for exemple ) :
CP -> STEVE ( good connectivity ) : Start transaction
Steve-> CP ( bad connectivity ) : accepted

But the CP never received the acknowledge by Steve and try to send it again ( sometimes many times ).

It should be useful to not store "duplicate" transactions in database. It is the same for connector status.

@goekay
Copy link
Member

goekay commented Jul 19, 2018

thanks for the report. let's address the connector status issue first. what's the problem with it? the database table is constructed in a way that duplicate status values should not be a problem. do you see multiple identical entries on the web ui for one connector?

goekay added a commit that referenced this issue Jul 19, 2018
reason: if the stations resends the same status message with the same
timestamp (due to connection problems for ex.) we were showing multiple
rows for the same connector with identical information in the web ui.
@goRaspy
Copy link
Author

goRaspy commented Jul 19, 2018

Hi Goekay, many thanks for your (very) fast answer.
Unfortunately I do not speak about GUI ( but you are right sometimes we can see double connectors status.

But my problem is about SQL database "pollution" especially for duplicates transactions whose need to be "cleaned" before used for statistic purpose.

Cheers

@goekay
Copy link
Member

goekay commented Jul 19, 2018

the GUI problem should be fixed with my referenced commit.

actually, the connector_status table by design is to be polluted. we treat it as an "append-only" data structure without any constraints or checks. therefore, every status message is just inserted into the table. but you are right, this simple "write approach" causes a more complicated and delicate "read approach", as can be seen here. i will look into this to improve this situation.

@goRaspy
Copy link
Author

goRaspy commented Jul 22, 2018

THanks you for working on connector status.
Concerning transactions, there any possibilities to "do not write" in database "clones" (same data, different transaction PK) ?

My need is to have a reliable view of chargepoint statistics without post treatment of data

@goekay
Copy link
Member

goekay commented Jul 22, 2018

my referenced commit 9e836fc does exactly that. it looks at the database for a transaction with identical information as in the message (chargebox, connector, idtag, timestamp, start value) and writes into database only if it is a new one. otherwise it returns the transaction pk of the existing database row.

@goRaspy
Copy link
Author

goRaspy commented Jul 22, 2018 via email

@goekay
Copy link
Member

goekay commented Jul 25, 2018

hey @goRaspy, did you test my commits? do they solve your problem? if the answer is yes, i want to close this issue.

@goRaspy
Copy link
Author

goRaspy commented Jul 25, 2018 via email

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