HNHacker News
TopNewBestAskShowJobs

wojcikstefan

341 karma · joined June 29, 2012

Software Engineer at Close (YC W11).

https://twitter.com/wojcikstefan https://github.com/wojcikstefan

submissionscomments
wojcikstefan··on Humans have caused 1.5 °C of long-term global warming according to new estimates
> A diet of mostly-plants can be just as delicious as one with a lot of beef.

I strongly disagree – as a person who's eaten vegan for over a year, tried all the fancy meat alternatives, and has gone back because a good grass-fed steak is just 10x more delicious.

wojcikstefan··on PostgreSQL Statistics, Indexes, and Pareto Data Distributions
Thank you very much! :) I still advise that you try really, really hard to avoid using `pg_hint_plan` if you can, but it's nice that it exists if all else fails or if you need temporary relief at a time of crisis.
wojcikstefan··on PostgreSQL Statistics, Indexes, and Pareto Data Distributions
Good intuition and thank you! :) Not sure if this is a good fit for you, but you could consider using the partitioning built into Postgres to split one large logical table with all your games into a "hot" partition containing the currently running games and a "cold" partition containing your finished games.

https://www.postgresql.org/docs/current/ddl-partitioning.htm...

wojcikstefan··on PostgreSQL Statistics, Indexes, and Pareto Data Distributions
Agreed, event sourcing is a pretty good match for call flows. You could first store every call leg / conference / recording / etc. webhook Twilio sends you as an event and then derive the state of the final "call" concept from those pieces of data.
wojcikstefan··on PostgreSQL Statistics, Indexes, and Pareto Data Distributions
Hi HN community, author of the post here. Let me know please if you have any questions, comments, or feedback!
wojcikstefan··on Temporal Python – A durable, distributed asyncio event loop (2023)
Can you tell us more about your scaling issues with Temporal?

I haven't yet used it in production, but I would've expected that a system which evolved out of Uber's Cadence [0] (and which I believe is used at Uber extensively) would've scaled very well.

[0]: https://stackoverflow.com/a/61281435/1579058

wojcikstefan··on Representing Enums in PostgreSQL
Hiya Aidan! :D

> Is this behaviour new?

Don't think so. Even the docs for SQLA v1.3 ([0]) mention it:

> native_enum – Use the database’s native ENUM type when available. Defaults to True. When False, uses VARCHAR + check constraint for all backends. The VARCHAR length can be controlled with Enum.length

[0]: https://docs.sqlalchemy.org/en/13/core/type_basics.html#sqla...

--

> Or is it that alembic still doesn't pick up changes to the enum to recreate the constraint?

Off the top of my head, I believe Alembic doesn't pick it up automatically. We make a lot of manual tweaks to our auto-generated Alembic migrations and I believe adding / modifying the CHECK constrains is part of it.

wojcikstefan··on Representing Enums in PostgreSQL
Whew, good to know! Another point towards the `CHECK` constraint approach. Thanks! :)
wojcikstefan··on Representing Enums in PostgreSQL
Can you elaborate on what it means to use PostgreSQL enums "on your code API"?

> It's such an outrageously naive idea that I'm sure most people here were attracted to the title thinking it's about algebraic types or some other similar misunderstanding.

Just to share how we at Close got into this discussion (which I personally don't find as "outrageous" as you), SQLAlchemy – which we use in our Python code – uses `native_enum=True` as the default value for its `Enum` type [0], which then translates to using types in PostgreSQL:

> native_enum – Use the database’s native ENUM type when available. Defaults to True. When False, uses VARCHAR + check constraint for all backends.

[0]: https://docs.sqlalchemy.org/en/20/core/type_basics.html#sqla...

wojcikstefan··on Representing Enums in PostgreSQL
> I usually use C# Enums translated by EF Core now (...)

Does this approach ensure data consistency? Or could you accidentally insert a number value into your table which is not represented by any of the enum values?

wojcikstefan··on Representing Enums in PostgreSQL
Apologies for my ignorance, but what does "FDW" stand for in your comment? :)
wojcikstefan··on Representing Enums in PostgreSQL
Just to make sure I understand your suggestion fully, you're saying: 1. Use `smallint` instead of `text` for the column type. 2. Otherwise follow our "`CHECK` constraint" approach (without it we're jeopardizing data consistency because we can store anything between -32768 and 32767 in that column). 3. Translate the int to the enum in your application.

Right?

wojcikstefan··on Silicon Valley Bank Failure [pdf]
Coca Cola & Red Bull are massive, they surely have tiny marketing spend… Right?
wojcikstefan··on GitHub to lay off 10% and close all offices
Agreed!
wojcikstefan··on GitHub to lay off 10% and close all offices
I thought it was GitLab which was remote-first (or should we say remote-only?). GitHub still seems to have offices and people going into them.
wojcikstefan··on GitHub to lay off 10% and close all offices
My heart goes out to the laid off employees, though I think they'll be able to find solid jobs (or start their own companies) when they're ready.

What I'm more surprised by is: 1. GitHub operating so independently from Microsoft at large that they have their own layoffs (not included in the 10k people that Microsoft announced they'll be parting ways with). 2. GitHub operating SO INDEPENDENTLY that they can decide to go remote-first.

wojcikstefan··on Companies hiring remote software engineers anywhere in the world
The YC company I work at (and have been happy working at for the last 11 years) is hiring remotely, anywhere in the time zones of Americas, Europe, and Africa: https://jobs.close.com
wojcikstefan··on My favorite iPhone feature was removed, long live its subpar replacement
I wholeheartedly agree with every single word in this post. I also mourn this feature's death daily. Being able to force-push on the spacebar is not good enough of a replacement.
wojcikstefan··on San Francisco Poop Map
Back when I lived in San Francisco I've met many people who used the SF311 app [0] where you can very quickly snap a picture and report an issue. One person I knew did so multiple times a day every day for many things – poop, trash, etc. The impressive thing was that the authorities would indeed show up often and clean things up.

[0]: https://apps.apple.com/us/app/sf311/id666635420

wojcikstefan··on Food Delivery Leak Unmasks Russian Security Agents
I live in Poland and regularly order Uber Eats/Wolt for $6-8.
wojcikstefan··on Building a no-code toxicity classifier by talking to GitHub Copilot
1. This is not “no-code”. You still have to read & understand the code Copilot generates.

2. I’m very skeptical of a small group of people reading a bunch of online comments and deciding what is “toxic” and “non-toxic”, even more so when it’s done with no clear definitions/guidelines. As their GitHub repo [0] says:

> Rather than operating under a strict definition of toxicity, we asked our team to identify comments that they personally found toxic.

[0]: https://github.com/surge-ai/toxicity

wojcikstefan··on IETF: The HTTP Query Method ( Draft)
I'm very happy about this proposal. The only sad thing is that it has come so late, after so many tools and protocols (e.g. GraphQL) already abuse POSTs for this use case.
wojcikstefan··on IETF: The HTTP Query Method ( Draft)
> Maybe have a X-GET-QUERY header to indicate the type if GET request?

Note that using the "X-" prefix has been deprecated since 2012: https://datatracker.ietf.org/doc/html/rfc6648

wojcikstefan··on IETF: The HTTP Query Method ( Draft)
IMO this helps a lot more people than just database folks. Any web application which implements a fairly granular search/filtering mechanism for its resources may run into the URL character limit with GETs. QUERY sounds much more appropriate here than what most applications do today (i.e. abuse POSTs).
wojcikstefan··on How We Improved Reliability of our WebSocket Connections
Ah, yep, that explains it.

They do solve this problem as documented: https://github.com/socketio/engine.io/blob/64d57545116c7a7d9...

wojcikstefan··on How We Improved Reliability of our WebSocket Connections
100% agree!
wojcikstefan··on How We Improved Reliability of our WebSocket Connections
Indeed it does! https://github.com/primus/primus/blob/a7ba7249cb0205a01629da...

I do wish we didn't all have to reinvent this wheel though…

wojcikstefan··on How We Improved Reliability of our WebSocket Connections
Thanks for pointing this out!

https://socket.io/docs/v4/how-it-works/#disconnection-detect... says:

> At a given interval (the `pingInterval` value sent in the handshake) the server sends a PING packet and the client has a few seconds (the `pingTimeout` value) to send a PONG packet back. If the server does not receive a PONG packet back, it will consider that the connection is closed.

So far this describes what we've already been doing prior to the fix mentioned in the blog post. However, this next sentence is where Socket.io's solution diverts from ours:

> Conversely, if the client does not receive a PING packet within `pingInterval + pingTimeout`, it will consider that the connection is closed.

Indeed looks like a solid way to solve the client-side recognition of a broken connection!

--

That said, I'm a little confused because I cannot find any mention of `pingTimeout` in their JS client [0], and `pingInterval` is only mentioned in an implementation of a test server [1]. I wonder if I'm looking at the wrong thing.

[0]: https://github.com/socketio/socket.io-client/search?q=pingti...

[1]: https://github.com/socketio/socket.io-client/search?q=pingin...

wojcikstefan··on How We Improved Reliability of our WebSocket Connections
Yes! I was both surprised and confused when I saw this. Unless I'm missing something, it means that every application implementing WebSockets has to reinvent the wheel, creating their client-side ping/pong handler using Data Frames since browsers don't automatically send nor expose an API for sending/acting on Control Frames.
wojcikstefan··on How We Improved Reliability of our WebSocket Connections
Remember to always blame the user… or the universe!
Page 1 of 4Next →