backstrokeapp / server

:swimmer: A Github bot to keep repository forks up to date with their upstream.
https://backstroke.co
MIT License
667 stars 62 forks source link

Add a list of all link operations that have completed on the link detail page. #80

Closed 1egoman closed 6 years ago

1egoman commented 6 years ago

Currently, the link detail page only allows the user to tell Backstroke which repositories to sync changes between. There's the potential for so much more, though.

A relatively low-hanging fruit would be to display all the link operations that have happened for that link in the last 24 hours, their status, and any resulting artifacts (ie, pull requests). Given this information and some descriptive error messages, a user would have all they'd need to gather insight into the status of their Backstroke links.

If it's a low-hanging fruit, then why hasn't it been done? In the current Backstroke architecture, link operation data flows in one direction. Once a link operation is dispatched, it's effectively it's own resource that's unrelated to a link. The server can (and does) fetch the status for a link, but that's not answering the question of What link operations have been handled for this link?

So, a change like this is going to require some slight rearchitecting.

Here's my plan: I want to create a second lookup in redis (the first being just by operation id) for operations. This second lookup would be a lookup by link id, which would then return a set of operation ids. So, to get all link operations for a link with id 5, I'd lookup a set in redis under the key 5, and loop through the resulting set, looking up each operation id by the first and old lookup method.

I considered duplicating the contents of the operation payload inside the sets, but then I have to worry about cache invalidation, and that's one of the hard things. I'd much rather take a small performance hit then risk data inconsistency.

Here's a proof of concept of my plan: https://github.com/backstrokeapp/worker/commit/665b07b319503b9608985af736450b043a3b2136

Most likely, this will take the back burner for now, since I'm working on getting https://github.com/backstrokeapp/server/issues/74 ready first. But, this is the next thing to work on after that.

1egoman commented 6 years ago

Turns out this wasn't too hard. It's complete and deployed: