7 karma · joined Jan 8, 2012 (14y ago) · 4 submissions
comment 6y ago · link · parent
That slowAPICall function should look like:
func slowAPICall(ctx context.Context) string {
d := rand.Intn(5)
t := time.NewTimer(time.Duration(d) * time.Second)
defer t.Stop()
...
}comment 6y ago · link · parent
comment 9y ago · link · parent
Ex-SoundClouder and Berliner here. I'm sad you haven't mentioned that in your previous comments in "Who is hiring?" threads. I once found a dead link in your comment and when I looked at job ads on your site I couldn't find any openings for Berlin.
comment 11y ago · link · parent
It's hard to write an asynchronous ORM though. Your options are either to use some existing synchronous ORM (like SQLAlchemy) in a thread pool (`loop.run_in_executor`) or use more low-level db driver: https://github.com/aio-libs/aiopg#example-of-sqlalchemy-opti...