FAQ
I am writing a server that uses amazon's DynamoDB and I want to limit the
rate at which I make calls to dynamo to prevent exceeding my reserved
capacity(which results in an error being returned and then I have to retry
the call after waiting a random amount of time).

How does this idea of using a buffered channel for scheduling look?
http://play.golang.org/p/mVZMyFVEzf

There is a channel that holds the previously used time, and before
performing an action each goroutine 'reserves' a time in the future to
perform the operation and sleeps until then, or runs immediately if it
doesn't need to wait. I'm not sure how reliable it will be since there is
no guarantee that a goroutine will wake up at exactly the time the sleep
expires. Can anyone comment on if this seems like a good idea or if there
is a better approach?

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJun 5, '13 at 1:48a
activeJun 5, '13 at 1:48a
posts1
users1
websitegolang.org

1 user in discussion

Brandonagr: 1 post

People

Translate

site design / logo © 2022 Grokbase