ssbc / ssb-db2

A new database for secure-scuttlebutt
47 stars 8 forks source link

Too hot binding #292

Closed arj03 closed 2 years ago

arj03 commented 2 years ago

I was testing too hot in async to see if I can see anything, I noticed that there appears to be a missing bind on this line: https://github.com/ssb-ngi-pointer/ssb-db2/blob/62e80f09d5e00d2039f8b1aec6a6005e618e0317/log.js#L83 It should be o.write.bind(o), right?

staltz commented 2 years ago

Hmm, technically, yes.

o is a sink, and there are cases where the sink uses this https://github.com/push-stream/push-stream/blob/master/sinks/drain.js but there are also cases of a this-less sink such as https://github.com/ssb-ngi-pointer/jitdb/blob/41a1b326a682b8c9a18f9b7dd7283021d31cc428/index.js#L641

arj03 commented 2 years ago

Yeah, the one used in async log tests used this :)

staltz commented 2 years ago

Let's slap a bind on it then :100: