should not throw when getting non-existant keys #1

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
@Raynos

Raynos commented Oct 1, 2012

No description provided.

@juliangruber

This comment has been minimized.

Show comment
Hide comment
@juliangruber

juliangruber Nov 28, 2012

Contributor

+1 for this. without that kv won't work with scuttlebutt on the server

Contributor

juliangruber commented Nov 28, 2012

+1 for this. without that kv won't work with scuttlebutt on the server

@juliangruber

This comment has been minimized.

Show comment
Hide comment
@juliangruber

juliangruber Nov 28, 2012

Contributor

This works but is ugly:

kv.has(key, function (err) {
  if (err) {
    onSync()
  } else {
    model.on('sync', onSync)
    kv.get(name).pipe(model.createWriteStream())
  }

  function onSync() {
    model.createReadStream().pipe(kv.put(name, { flags : 'a' }))
  }
})
Contributor

juliangruber commented Nov 28, 2012

This works but is ugly:

kv.has(key, function (err) {
  if (err) {
    onSync()
  } else {
    model.on('sync', onSync)
    kv.get(name).pipe(model.createWriteStream())
  }

  function onSync() {
    model.createReadStream().pipe(kv.put(name, { flags : 'a' }))
  }
})
@dominictarr

This comment has been minimized.

Show comment
Hide comment
@dominictarr

dominictarr Nov 29, 2012

Owner

This patch is wrong, It doesn't open the gate if there is no has fails, so end won't be emitted.
also, I don't really think you want an empty stream. that is weird. this behaviour seems more surprising,

Currently, this has the same behavior as fs, to emit 'error'

Owner

dominictarr commented Nov 29, 2012

This patch is wrong, It doesn't open the gate if there is no has fails, so end won't be emitted.
also, I don't really think you want an empty stream. that is weird. this behaviour seems more surprising,

Currently, this has the same behavior as fs, to emit 'error'

@Raynos

This comment has been minimized.

Show comment
Hide comment
@Raynos

Raynos May 15, 2014

Closing this due to staleness

Raynos commented May 15, 2014

Closing this due to staleness

@Raynos Raynos closed this May 15, 2014

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