Hey ๐ I'm Gio!
๐ญ Currently: stealth mode project ๐ฅท
Previously:
- Technical co-founder @ Caribou
- Founding engineer @ Setter (Acquired by ThumbTack)
- Alumn @ Next36
keep your pubsub saucy
License: MIT License
Hey ๐ I'm Gio!
๐ญ Currently: stealth mode project ๐ฅท
Previously:
Seeing logs like this in our logs:
[pubSubMessageHandler] - 0322fba9-4609-43b4-8e8e-38e9f4fe0352 - Failed to process pubsub request - {"error":"invalid_event_data","reason":"Data for subscription \"<REDACTED>\" did not pass validation. Data: [object Object]"}
The issue is here:
Line 326 in e116b74
We're not calling JSON.stringify
Imagine the following architecture:
In this (very common) architecture, there is a scenario that is very common with PubSub Push Messages.
123
123
and forwards to node A
123
a1pubsub
:)123
a 2nd time, but forwards it to node B
123
Oh nooo, node B
was not aware that node A
was already processing message 123
.
Thankfully the fix is quite straight forward. And provides a reasonably high level of confidence. Assumption is that query_latency
< latency_between_original_and_duplicate_pubsub_message
. If this assumption is not true, then this fix doesn't work.
You can acquire a lock on messages by leveraging the EventStatus
enum.
https://github.com/supermacro/a1pubsub/blob/master/src/index.ts#L42
And then inside of handlePubSubMessage
, check if there's already a cached message that is in_progress
. If true, then throw away the current message since it's a duplicate.
Would be great to have a CLI to make working with pubsub even easier:
<eventName>__<actionToTake>
naming patternA declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.