Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What happens when a defer-generated cb() is called back one than once? #11

Closed
maxtaco opened this issue Feb 2, 2012 · 2 comments
Closed

Comments

@maxtaco
Copy link
Owner

maxtaco commented Feb 2, 2012

Should maybe make it impotent after the first call, and or have the Deferrals object complain if its counter drops below 0.

@craigyk
Copy link

craigyk commented Feb 13, 2012

Are you trying to figure out how to handle callbacks that are passed for things like progress updates (so they're legitimately called more than once)? Or are there circumstances where the iced implementation might be buggy and you want to catch them?

@maxtaco
Copy link
Owner Author

maxtaco commented Feb 13, 2012

I was worried about this case:

loop
  await fs.watchFile "/path/to/some/changing/file.txt", {}, defer curr, prev
  console.log "it changed!"

This is an issue because fs.watchFile will call back repeatedly, every time the file is changed (unless you give { persistent : 0} as options). You'll wind up with n^2 log lines, for n changes. Probably not what you wanted.... In this case, I would say just use hand-rolled cbs, but the iced runtime should warn you.

maxtaco added a commit that referenced this issue Sep 19, 2012
defers are being abused, like with mutliple calls per deferral, or a
reentry to a dead await block.  We still want to allo multi-use of a
deferral, and do that in the case of a Rendezvous with the id(1,true)
feature.
maxtaco added a commit that referenced this issue Dec 5, 2012
defers are being abused, like with mutliple calls per deferral, or a
reentry to a dead await block.  We still want to allo multi-use of a
deferral, and do that in the case of a Rendezvous with the id(1,true)
feature.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants