Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/chan1/oneway/phandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func main() {
handler := getPersonHandler()
origs := make(chan Person, 100)
dests := handler.Batch(origs)
fecthPerson(origs)
fetchPerson(origs)
sign := savePerson(dests)
<-sign
}
Expand All @@ -85,14 +85,14 @@ func savePerson(dest <-chan Person) <-chan byte {
return sign
}

func fecthPerson(origs chan<- Person) {
func fetchPerson(origs chan<- Person) {
origsCap := cap(origs)
buffered := origsCap > 0
goTicketTotal := origsCap / 2
goTicket := initGoTicket(goTicketTotal)
go func() {
for {
p, ok := fecthPerson1()
p, ok := fetchPerson1()
if !ok {
for {
if !buffered || len(goTicket) == goTicketTotal {
Expand Down Expand Up @@ -129,7 +129,7 @@ func initGoTicket(total int) chan byte {
return goTicket
}

func fecthPerson1() (Person, bool) {
func fetchPerson1() (Person, bool) {
if personCount < personTotal {
p := persons[personCount]
personCount++
Expand Down