Glimesh / glimesh.tv

Glimesh is a next generation live streaming platform built by the community, for the community.
https://glimesh.tv
Other
470 stars 79 forks source link

Homepage showing more than 6 streams #655

Open clone1018 opened 3 years ago

clone1018 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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!

Eein commented 3 years ago

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