Skip to content

Instantly share code, notes, and snippets.

@Twipped
Last active August 29, 2015 14:24
Show Gist options
  • Save Twipped/c7ed2a2db00fdbfb76a9 to your computer and use it in GitHub Desktop.
Save Twipped/c7ed2a2db00fdbfb76a9 to your computer and use it in GitHub Desktop.
Problem: Identifying identical events on different IRC connections

Say you have a process that is connected to two or more different IRC servers running on the same network, and you want to aggrigate events on both servers into a single stream.

Due to latency within the network, events may arrive from both servers in different order and at different times. The events look identical in how they arrive, and may be identical to simmilar events occuring at another time (eg, a user joins, parts and re-joins, producing two identical join events).

How do you reconcile the streams?

@Twipped
Copy link
Author

Twipped commented Jul 4, 2015

I'm thinking that perhaps I could hash the contents of the event and store it with a list of all connections that have seen that hash. When an event occurs, look for the most recent matching hash that server hasn't mapped to. Then if the same hash occurs twice, each connection reconciles the events in the order they receive them.

I'm just not sure how to handle if one of the connections doesn't receive one of the events (eg, during a netsplit).

@kball
Copy link

kball commented Jul 4, 2015

I'm not super familiar with IRC... what do you have as data within the event? Do you have any sort of timestamp? (even if it is specific to that server?)

IE can you construct with certainty the order that a particular server saw events even if their arriving to you in a different way? Because you may be able to e.g. handle the identical/recurring events issue by looking at a few more items in the sequence

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment