Implement context #86
Loading…
Reference in New Issue
No description provided.
Delete Branch "implement-context"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I'm trying to implement a
Context
struct, so we dont have to pass around DbPool, ChatServer, Client, and soon ActivitySender all the time. This isnt going to change any logic or behaviour, just make parameter lists shorter. Its essentially #1082, but without the request_counter (that should go somewhere else as the context should be stateless).At the moment its failing with this error, any idea how to fix it?
Okay this is almost working, the only thing left is figuring out a proper lifetime for the return types on context functions. Or we could return by value instead, but returning by reference seems better (maybe I'm wrong though).
Attempt to implement contextto Implement contextUpdated, I finished replacing everything. Now I need to figure out why all the federation tests are failing.
Some of the errors I'm seeing:
May have found the issue: run
grep -r "web::Data" server/src/
There's a lot of
web::Data
refs that need to change to context. Its annoying that actix doesn't warn you about these.Ah I didnt even see your comments. Yep that was the problem, I went through our routes and replaced all the web::Data. Might be good to double check cause as you said, the compiler doesnt warn about it.
Also this was a lot of mindless work replacing everything, hopefully we dont have to do that again any time soon.
Edit: Federation tests are passing now.
Rebased. Btw I had a failure in the test
Sticky a post
, but it passed fine when I ran the tests again.Looks good, and all the tests passed. The only other
web:Data<
references are inimages.rs
, but you're creating another client there, so its good.