anaconda
anaconda copied to clipboard
Calling api.SetDelay() as mentioned in readme panics
If you do this:
You get the panic:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x11cd32]
goroutine 1 [running]:
panic(0x24a620, 0xc42000c0d0)
/usr/local/Cellar/go/1.7.4/libexec/src/runtime/panic.go:500 +0x1a1
github.com/ahmetalpbalkan/goodbye/vendor/github.com/ChimeraCoder/tokenbucket.(*Bucket).SetRate(0x0, 0x0)
/Users/alp/workspace/gopath-goodbye/src/github.com/ahmetalpbalkan/goodbye/vendor/github.com/ChimeraCoder/tokenbucket/tokenbucket.go:41 +0x22
github.com/ahmetalpbalkan/goodbye/vendor/github.com/ChimeraCoder/anaconda.(*TwitterApi).SetDelay(0xc420012780, 0x0)
/Users/alp/workspace/gopath-goodbye/src/github.com/ahmetalpbalkan/goodbye/vendor/github.com/ChimeraCoder/anaconda/twitter.go:156 +0x39
main.mkClient(0xc4200ca9e0, 0x15, 0xc420019020, 0x2b, 0xc420010700, 0x31, 0xc420019050, 0x2a, 0xc420019050, 0x2a, ...)
/Users/alp/workspace/gopath-goodbye/src/github.com/ahmetalpbalkan/goodbye/main.go:89 +0xe4
main.main()
/Users/alp/workspace/gopath-goodbye/src/github.com/ahmetalpbalkan/goodbye/main.go:36 +0x3ac
because api.bucket
field is nil.
I had a similar issue, but I found a fix
It looks like you have to call api.EnableThrottling()
first, then you're able to call api.SetDelay()
.
The README section on throttling notes that throttling is off by default, but it would be nice to have a nice one-liner that tells the user how to enable Throttling (and explain a little more about the bufferSize
argument in the EnableThrottling()
function call)
+1, four years later I'm getting the same issue.