glimesh.tv
glimesh.tv copied to clipboard
Homepage showing more than 6 streams
Shouldn't technically be possible, but it looks like we have a misconfigured query somewhere...
Database State:
id | channel_id | slot_started_at | slot_ended_at |
---|---|---|---|
1902 | 10552 | 2021-04-23 13:53:54 | 2021-04-23 14:53:54 |
1901 | 5600 | 2021-04-23 13:53:54 | 2021-04-23 14:53:54 |
1900 | 7538 | 2021-04-23 13:53:54 | 2021-04-23 14:53:54 |
1899 | 12937 | 2021-04-23 13:53:54 | 2021-04-23 14:53:54 |
1898 | 13204 | 2021-04-23 13:53:54 | 2021-04-23 14:53:54 |
1897 | 503 | 2021-04-23 13:53:54 | 2021-04-23 14:53:54 |
1896 | 7538 | 2021-04-23 13:53:54 | 2021-04-23 14:53:54 |
1895 | 13204 | 2021-04-23 13:53:54 | 2021-04-23 14:53:54 |
1894 | 503 | 2021-04-23 13:53:54 | 2021-04-23 14:53:54 |
1893 | 5600 | 2021-04-23 13:53:54 | 2021-04-23 14:53:54 |
1892 | 10552 | 2021-04-23 13:53:54 | 2021-04-23 14:53:54 |
1891 | 14586 | 2021-04-23 13:53:54 | 2021-04-23 14:53:54 |
Oops, I think there should be a group_by here:
https://github.com/Glimesh/glimesh.tv/blob/1f6d25a7bf57662f867bc39933141c0041d09b24/lib/glimesh/homepage.ex#L84-L100
Looking into this more, it's not reproducible in development. It's likely the homepage generator script is either being run by two nodes, or the same node is running it twice!
worst case you can cap limit 6 after the query to chop off the end :) that would be the easiest fix as long as there isn't a major performance cost to doing a Repo.all