Last Generation Time

Development & Technical discussion about Timekoin.
Forum rules
Bug Collecting Database is Click Here
GitHub Account is Click Here
Post Reply
warmach
Posts: 404
Joined: Thu Jun 21, 2012 5:18 pm

Last Generation Time

Post by warmach »

I am looking for a reliable method for getting the last generation time for a key.

On the generation tab, it is displayed. I used this method in my KeyInfo plugin, but I've found that it sometimes displays that a key is not elected. I am pretty sure this is because the generation peer list is always changing and being updated. You can sometimes check the generation status and the list is still being updated from the network.

I'd rather not do a trans history search if possible. Is there a more reliable way to get the last time a key generated currency?
User avatar
KnightMB
Site Admin
Posts: 1019
Joined: Thu Feb 23, 2012 5:03 pm

Re: Last Generation Time

Post by KnightMB »

How is KeyInfo getting the last generation time right now? Pulling from the Generation Peer List?
warmach
Posts: 404
Joined: Thu Jun 21, 2012 5:18 pm

Re: Last Generation Time

Post by warmach »

KnightMB wrote:How is KeyInfo getting the last generation time right now? Pulling from the Generation Peer List?
Yes
User avatar
KnightMB
Site Admin
Posts: 1019
Joined: Thu Feb 23, 2012 5:03 pm

Re: Last Generation Time

Post by KnightMB »

The Generation Peer Manager uses the same information to determine when to kick keys from the list, so at least from the server perspective it should be accurate. Can you reproduce the missing gen times with just hitting the refresh button a few times or is it very random? Do you need a lot of keys in the list or can one do it?
warmach
Posts: 404
Joined: Thu Jun 21, 2012 5:18 pm

Re: Last Generation Time

Post by warmach »

KnightMB wrote:The Generation Peer Manager uses the same information to determine when to kick keys from the list, so at least from the server perspective it should be accurate. Can you reproduce the missing gen times with just hitting the refresh button a few times or is it very random? Do you need a lot of keys in the list or can one do it?
I have 8 keys in my list. It is pretty random, but consistent enough to be a concern. The most I've seen is 3 of the 8 saying that the keys were not elected. If I run the plugin again, the data corrects itself.

The Gen Peer Manager may use this information, but it also relies on the network to verify what is doing is correct. If it thinks a key should be removed, it does it. Then the Manager checks the network and corrects itself if necessary. The network acts as a backup to the Gen Peer Manager. I think it is during this clearing and refreshing of the data that KeyInfo plugin pulls back empty data and thinks the key is not elected.

I may try and setup the KeyInfo plugin and all the keys on another server. I can then verify that it isn't machine specific...This machine does act a bit squirrelly sometimes...
User avatar
KnightMB
Site Admin
Posts: 1019
Joined: Thu Feb 23, 2012 5:03 pm

Re: Last Generation Time

Post by KnightMB »

It will correct itself, but there is a few minutes delay before it does. If you check the logs, around the time that the keys go missing, does it show anything like this:

Code: Select all

Generation Peer List has Become Stale, Attemping to Purge and Rebuild.
I could see that causing issues until the list is rebuilt from the network, but it should not happen every button click though.
warmach
Posts: 404
Joined: Thu Jun 21, 2012 5:18 pm

Re: Last Generation Time

Post by warmach »

KnightMB wrote:It will correct itself, but there is a few minutes delay before it does. If you check the logs, around the time that the keys go missing, does it show anything like this:

Code: Select all

Generation Peer List has Become Stale, Attemping to Purge and Rebuild.
I could see that causing issues until the list is rebuilt from the network, but it should not happen every button click though.
Sorry, I didn't explain correctly. It does not happen every time. It does happen about once per day and I usually check about 4 or 5 times in a day. When I was talking about having a more reliable method, I was thinking about it in relation to a service that sends emails when generation halts for more than an hour. I'm trying to avoid false positives in the service.

Looking at the logs, I do see that 3 - 4 times a day, it does purge the list and rebuild it. Is that normal server behavior or is that happening too often?
User avatar
KnightMB
Site Admin
Posts: 1019
Joined: Thu Feb 23, 2012 5:03 pm

Re: Last Generation Time

Post by KnightMB »

warmach wrote:Sorry, I didn't explain correctly. It does not happen every time. It does happen about once per day and I usually check about 4 or 5 times in a day. When I was talking about having a more reliable method, I was thinking about it in relation to a service that sends emails when generation halts for more than an hour. I'm trying to avoid false positives in the service.

Looking at the logs, I do see that 3 - 4 times a day, it does purge the list and rebuild it. Is that normal server behavior or is that happening too often?
Ah ok, well first 3 or 4 times a day (not every few minutes) is ok, the list changes as peers are added or dropped (from being offline) If it was happening every few minutes I would have concerns. :shock:

Well, then truly the transaction history is where to find out for certain. It would not have to be a very intense query, you could simply select every transaction in the last hour, filter by attribute. If the keys you need to watch don't show up in the query, then you know right away the server is down (or lost Internet somewhere). That would help stem false positives without the need to smash the database with a large/repeated query.

This one brings up every server that generated in the last hour (try it in phpmyadmin for example, might need to adjust time if you try this an hour later). Speed wise on the Raspberry Pi (359 total, Query took 0.0032 sec)

Code: Select all

SELECT public_key_from  FROM `transaction_history` WHERE `timestamp` > 1392056599 AND `attribute` = 'G'
So one query brings up the list, then cycle through all the keys you want to check. Should be quick and efficient. :D
Post Reply