mrkaye97
I'm back at my One Trusted Dentist now, and the only way anyone's getting me out of that chair is in a body bag.
I have a sneaking suspicion that people are having some agent check out 500 repos and just prompting with “find a bug in this repo and fix it” and submitting the results blindly.
Edit: typos, on mobile
Agreed codegen works fine here too by the way, but it feels kind of clunky to me (it’s something I don’t love about Go, although I know it’s also an important part of the ecosystem and is popular).
@hatchet.task()
async def my_task(...) -> SomeOutputType:
return SomeOutputType(...)
## imagine this is an API handler:
@api_handler("/some/path")
async def handle() -> ...:
result = await my_task.run(...)
# we now know `result` is of type `SomeOutputType` without any sort of type assertion, etc.
Admittedly, I'm not a Go expert, nor am I a programming languages expert. But I do feel that this type of behavior is really only possible (with nice ergonomics) with generics, and it's always been upsetting to me that somehow Python's type system feels more complete than Go's in this arena, or at least it has until more recently.Maybe this falls into the 1% of cases, but I'd suspect this sort of thing is more common than that.
Edit: I should have mentioned - in the Python example above, `@hatchet.task` is generic with the output type of the task it wraps.
All Soda Yearns to Be Red
I'm sorry I didn't respond to your job application
Also, to re-emphasize: we do this rarely, but it's been helpful the times we've done it
I, at least, don't know of a perfect fix here. Re: the original comment - Postgres will also error on deadlocks after it detects them without setting your isolation level to Serializable, but I agree with you that often retrying doesn't help, and could even cause cascading / snowballing failures if you have a backlog of retries piling up because of deadlocks.
I don't know if there's a good solution, really. We've fixed deadlocks incrementally over time as we've found them, which has worked pretty well, but of course that means also needing to deal with the "finding" part, which has generally come in the form of lots of `deadlock detected` log lines and errors (and retries accompanying those).
One thing that might be worth auditing is why there are two different bits of application code that are updating the same rows in two different tables in different orders. I know it's a contrived example, but it seems like it could be a code smell to me. Maybe this is the kind of thing that arises when two different subteams are working on the same database and are largely siloed.
Alexander will likely have more thoughts here as well, just my two cents!
One small addendum here is we've had a lot of success performing joins in memory in a few very specific situations where the alternative is a single, often overcomplicated query. I've heard / seen advice many times in the past about performing fewer round trips to the database being something to optimize for (often good advice!). Sometimes this is taken too far, resulting in overly-complex queries requiring complicated JOIN or UNION logic, CASE logic, and so on.
We have a couple of places in our codebase where we perform two or more simpler queries independently instead, and then loop through their results and use maps to match the relevant rows. Conventional wisdom often suggests this path will hurt performance because of the extra database round trip in addition to the loops needed to perform the join, but it is actually beneficial in these cases because of more predictable query planning behavior. We use this trick sparingly, but it can be helpful in a pinch.
Note that some ORMs will also do this for you in the background, which we don't necessarily endorse, and we try to use this sparingly when writing a single query on its own is not realistic.
Handling Graphs with SQL/PGQ in PostgreSQL
Happy to answer more questions beyond this!
All the Worst People Seem to Want to Be 'High Agency'
Pg_plan_advice: Plan Stability and User Planner Control for PostgreSQL?
Show HN: Call Your Loved Ones
Hey HN!I've been needing to do a better job of staying in touch with the people who are important to me. So I built a little app that lets me add people to call, and tells me when I last called them. I figured some of you might find this useful in some way :)The code is here: https://github.com/mrkaye97/call-your-loved-onesIf you go to the URL linked in the post, you can use the app with all of...
Show HN: Medici, an open-source Splitwise-like app for managing expenses
https://github.com/mrkaye97/medici
Hey everyone!I've been working on this little app I'm calling Medici after getting annoyed with Splitwise only allowing me to submit a few expenses a day. It has all the main Splitwise features (debt simplification, different ways of splitting expenses, default splits, etc.)Would love feedback and just wanted to share! I'm self-hosting on my RaspberryPi and figured others might find it useful...
Show HN: Medici, a minimal, open-source, dead-simple Splitwise alternative
https://github.com/mrkaye97/medici
Hey everyone!I've been a Splitwise user for a long time (sometimes paying, sometimes not), and have been rather frustrated at their new-ish policy of only allowing N (small) expenses to be submitted per day. And I was curious to write some Rust and thought the expense simplification algorithm would be fun to implement, so I built this.Thought others might find it fun or useful! It's dead simple...
Mostly to learn some Rust and because I thought most of the features of Splitwise worth paying for would be fun to build. Been loving working in Axum and getting to implement some fun database things