-
Notifications
You must be signed in to change notification settings - Fork 49
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
feat: handlers and dispatchers for get_bso and put_bso #4
Conversation
Hey Phil, sorry I didn't see this until later in the day. I don't have a good answer yet =] Ben and I will take a closer look tomorrow (our time) (Also I turned on slack notifications on this repo to #push-dev-bots so we'll get nagged there immediately when PRs open) |
No worries, I should have mentioned in IRC too, wasn't thinking! |
In the cold light of day this was pretty straightforward to resolve (quelle surprise). The second approach works fine if I use I also wrote some integration tests for the server stuff, currently they just assert that the routes don't fail with a valid Note that although it looks like travis has failed on this PR, if you look at travis for my fork the tests are green: https://travis-ci.org/philbooth/syncstorage-rs/builds/408578028 (and the tests pass locally of course) Not sure what's up with the
I don't have permission to clear the caches on the build unfortunately but I usually find that fixes this kind of thing, if someone who has the authority wants to give it a try. |
# This is the 1st commit message: bug: Address AlreadyExist errors * rework error logging/metric reporting. * Added `is_reportable()` and `metric_label()` to `ErrorKind`s * removed unused `metric_label` field from ApiError Closes #174, #619, #618, #827 # The commit message #2 will be skipped: # f WIP: nightly # # * TODO: why is insert not seeing int64 type? # * TODO: add mysql fixup. # The commit message #3 will be skipped: # f fix test # The commit message #4 will be skipped: # f fix tests
I spent a bit of time today working on dispatchers for
get_bso
andput_bso
. Although they broadly seem to work (they compile! 😄), I'm not very happy with the code as it stands. As usual I had some trouble bending Rust to my will, hence I'm opening a WIP PR in the hope that you guys can help me with some async pointers on what I could be doing better.The main problem I struggled with was extracting the common code from the two dispatcher bodies out to a separate method. As you'll see in the diff, there is a fair amount of duplicate code in each body and the indentation got pretty crazy as it wouldn't let me flatten the combinator chains.
I tried two things to fix it:
A helper method on
DBExecutor
that returnsMutexGuard<DBManager>
:That complains about the lifetime of
db_handles
:Variation on the above, this time the helper method takes an
FnOnce
for running the action code beforedb_handles
goes out of scope:...which complained about unsatisfied
FnOnce
trait bounds:(also the error handling is a hack right now)
Any suggestions @bbangert / @pjenvey / @rfk?