Sometimes host has double fact-keys

Problem:
Now and then we find hosts who have double fact-keys/values. For example we have 3-4 hosts who have the follow facts double: mysql_version (custom fact). In Foreman the oldest version is being shown and not the most recent one.

Expected outcome:
Should see 10.3 instead of the old value; 10.1

Foreman and Proxy versions:
1.21

Foreman and Proxy plugin versions:

Other relevant data:
I already tried to run foreman-rake facts:clean but no go.

Hey, define “double fact-key” term please.

Basicly I have 1 fact name let’s say: mysql_majorversion. But seems the key is double in the fact_names table:

| 481 | mysql_majorversion | 2017-01-23 14:46:31 | 2017-01-23 14:46:31 |       0 | mysql_majorversion | FactName       | NULL     |
| 301 | mysql_majorversion | 2016-01-19 13:34:16 | 2016-01-19 13:34:16 |       0 | mysql_majorversion | PuppetFactName | NULL  

I think this seems to be the problem that there are 2 the same names.

Probably a race condition. Can you grep from logs last 100 of fact uploads from this client (by IP address) and see if there were some requests processed concurrently?