Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Async HTTP(S) client

by Anonymous Monk
on Mar 05, 2025 at 18:39 UTC ( [id://11164166]=note: print w/replies, xml ) Need Help??


in reply to Async HTTP(S) client

i've been battling with a few modules made by a former co-worker ... so i spent a couple of hours writing my own

So...... who's going to maintain your reinvented wheel... and will they end up calling your code "garbage" too? Mojo::UserAgent

Replies are listed 'Best First'.
Re^2: Async HTTP(S) client
by cavac (Prior) on Mar 20, 2025 at 15:49 UTC

    Just for reference: I hardly ever call code "garbage". But this is code that does (or is supposed to) run debit card transactions. I can't post it here (closed source), but the following problems have been observed in prodution systems:

    • Timeout mismatches. The code marks transactions as failed even when they went through, with the effect that debit cards were double charged.
    • Transactions that don't time out at all, forcing the user to restart the cash register.
    • Working on the wrong transaction, with the effect that the customer gets charged the incorrect amount.
    • No handling of child process exits, leading, again to forcing the user to restart the cash register.
    • Not restart safe. Restarting the cash register (reboot, power loss, etc) while a transaction is in progress can lead, again, to the process working on the wrong transaction, charging the customer the wrong amount.
    • A temporary connection loss of connection to the cloud server of the debit terminal provider again can lead to the transaction marked as failed (when it was processed successfully on the provider side), potentially leading to again double charge the customer.

    In many cases i can be somewhat lenient about bugs. And as long as the software just crashes and can cleanly restart, nothing will go wrong - this case is already handled by my service manager software. Not good, but we are taking about a downtime of a couple of seconds of a background service, something the user will hardly notice if at all.

    But when you are developing software that is dealing with other peoples money (in our case, the customers of our customers), "move fast and break things" is absolutely in no way acceptable. It has to work. Perfectly. Each and every time.

    If there is a chance greater than one in a million transactions that a specific error happens, the software needs to handle that error correctly. After all, for busy shops such a "rare" error would at least happen every couple of years. Multiply that by a large number of customers. It's the curse of scaling. And it can easily turn into a PR nightmare, especially since people are trusting that their debit and credit card transactions just work. And, oh, if the problem keeps happening, one can easily loose certification by the debit/credit card terminal provider, which is an even bigger quantum leap in "oh shiiiiiit!".

    In cases of critical code like this, frankly, one small bug is a disaster. Multiple large bugs that amplify each other is what made me declare that piece of code "garbage".

    PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP
    Also check out my sisters artwork and my weekly webcomics
      that adresses exactly zero of the questions raised

        who's going to maintain your reinvented wheel

        That is exactly the same question i have. For all modules, both the ones developed in house and the ones maintained by a third party that i just download from CPAN.

        and will they end up calling your code "garbage" too?

        Maybe? But that hasn't happened in the last decade or so.

        Mojo::UserAgent

        No. It doesn't fit into the way my cyclic executives are designed (which i have used in producion code for 15+ years).

        And Mojo::UserAgent has an astonishingly ugly syntax, looks like JavaScript. Yes, i develop in JS, too, and yes, i am forced to use Promises, and yes that's also an ugly syntax.

        Happy?

        PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP
        Also check out my sisters artwork and my weekly webcomics

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11164166]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2025-05-21 02:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.