Week 24 - 2019
The weeknote for 6/10 - 6/16.
OSS
denoland/deno
🦕 Deno is a new JavaScript and TypeScript runtime.
- This week version 0.9.0 has been released, which includes
deno install
subcommand. Now we can install the standalone cli as follows:
$ deno install file_server https://deno.land/std/http/file_server.ts --allow-net --allow-read
MyProject
kt3k/moneybit-app
💰 Moneybit is an open source mobile accounting app.
- I made a little progress on
delete
-modal in chart-settings page. Now I realized I have 3 different approaches for creating modal in this app (feeling a little silly). Comparing these 3, I decided to follow the one used intitle-area
of document-settings page, which has the most encapsulated design. It is single event, single dom approach. The overlay shadow is the container of modal dialog. The other two have separate overlay shadows and modal dialog doms. The former is simpler, but less flexible. The latters are more complex, but more flexible.
Job
goroutine leaks
- At @seqsense, we use Go language in many places. Though I first joined this team as a frontend engineer, but now I help implementing the data collector agent in Go language. This week I first experienced I leaked a goroutine. Thanks to @t-asaka's review, that leak has never been deployed to the actual device, but it was about to be shipped and I really didn't realize it leaked.
func Foo() {
...
for _, item := range list {
go func(item Item) {
c <- doNetworkJob(item)
}(item)
}
for range list {
err <- c
if err != nil {
return err
}
}
...
}
I supposed this worked like something JavaScript equivalent of:
function foo() {
...
try {
await Promise.race(list.map(doNetworkJob))
} catch (e) {
throw e
}
...
}
But it actually isn't. This leaks the gorouines after leaving the function Foo
because the channel c
looses the receiver and c <- doNetworkJob(item)
blocks
forever!
Movie
MIB: International
- Seen Men In Black: International. I liked the hammer scene.