glimesh.tv icon indicating copy to clipboard operation
glimesh.tv copied to clipboard

Homepage showing more than 6 streams

Open clone1018 opened this issue 3 years ago • 3 comments

Shouldn't technically be possible, but it looks like we have a misconfigured query somewhere...

image

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

clone1018 avatar Apr 23 '21 14:04 clone1018

Oops, I think there should be a group_by here:

https://github.com/Glimesh/glimesh.tv/blob/1f6d25a7bf57662f867bc39933141c0041d09b24/lib/glimesh/homepage.ex#L84-L100

clone1018 avatar Apr 23 '21 14:04 clone1018

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!

clone1018 avatar Apr 25 '21 16:04 clone1018

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

Eein avatar Jun 02 '21 04:06 Eein