This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for it := eventStream.Subscribe().Iterator(); true; { | |
v, err := it.Next(ctx) | |
if err == eventstream.ErrDone { | |
return nil | |
} else if err != nil { | |
return err | |
} | |
msg := v.(bwamp.Event) | |
// [Send msg to client] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type LogReplicatedModel struct { | |
mu sync.RWMutex | |
snapshot Model | |
stream eventstream.EventStream | |
} | |
func (m *LogReplicatedModel) ReadAndSubscribe() (Model, eventstream.Promise) { | |
m.mu.RLock() | |
defer m.mu.RUnlock() | |
return m.snapshot, m.stream.Subscribe() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
go install github.com/fullstorydev/go/examples/chatterbox/...@latest | |
chatterbox server | |
chatterbox monitor # in another terminal | |
chatterbox client # in another terminal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///usr/bin/env true; exec /usr/bin/env go run "$0" "$@" | |
package main | |
import ( | |
"fmt" | |
"log" | |
"os" | |
"os/exec" | |
"path/filepath" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package concurrency | |
import ( | |
"context" | |
"fmt" | |
"golang.org/x/sync/errgroup" | |
) | |
const ( | |
doThingWorkers = 4 |
OlderNewer