Skip to content

Remove unwraps from non-test code in queue/redis #551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

svix-dylan
Copy link
Contributor

We had a lot of unwraps in our Redis-based queue implementation. This PR refactors them to be .expect()s where appropriate, or to bubble errors up to a calling function that catches them.

@svix-dylan
Copy link
Contributor Author

Would love feedback on this. I've only done a cursory run through. Open questions include, in functions that call and catch errors from the migrate_ functions -- how do we want to handle these errors? Currently I'm just passing them to a trace::error!. But they are nonrecoverable, right?

@@ -367,15 +370,17 @@ fn to_redis_key(delivery: &TaskQueueDelivery) -> String {
format!(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should just change this function to return a result, just in case, since this method is called w/in the send method which is potentially heavily used.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I think this is much more concerning than e.g. the migrations.

migrate_list(&mut conn, v1_main, v2_main).await;
migrate_list(&mut conn, v1_processing, v2_processing).await;
migrate_sset(&mut conn, v1_delayed, v2_delayed).await;
let r1 = migrate_list(&mut conn, v1_main, v2_main).await;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way to do it in tests is just to unwrap. This is too cumbersome.

@tasn
Copy link
Member

tasn commented Aug 17, 2022

This was now fixed by @svix-james in another PR, no?

@svix-jplatte
Copy link
Member

Outdated in many ways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants