Решение на Concurrent Retry Executor от Добромир Иванов

Обратно към всички решения

Към профила на Добромир Иванов

Резултати

  • 6 точки от тестове
  • 0 бонус точки
  • 6 точки общо
  • 5 успешни тест(а)
  • 3 неуспешни тест(а)

Код

package main
import (
"strconv"
)
func handleLog(channel chan string, logNumber int, result chan string, internalChan chan int) {
messages := make([]string, 0)
channelClosed := false
lockTaken := false
for {
select {
case message, ok := <-channel:
channelClosed = !ok
if !channelClosed {
messages = append(messages, strconv.Itoa(logNumber)+"\t"+message)
}
default:
}
if len(messages) > 0 {
if !lockTaken {
select {
case log, ok := <-internalChan:
if log == logNumber && ok {
lockTaken = true
} else if ok {
internalChan <- log
}
default:
lockTaken = false
}
} else {
select {
case result <- messages[0]:
messages = messages[1:]
default:
}
}
}
if channelClosed && len(messages) == 0 {
if lockTaken {
internalChan <- logNumber + 1
}
return
}
}
}
func waitForLog(logs chan (chan string), result chan string) {
logCount := 1
internalChan := make(chan int)
lockTaken := false
go func(channel chan int) {
channel <- 1
}(internalChan)
for log := range logs {
go handleLog(log, logCount, result, internalChan)
logCount += 1
}
for !lockTaken {
select {
case log, ok := <-internalChan:
if log == logCount && ok {
lockTaken = true
} else if ok {
internalChan <- log
}
default:
lockTaken = false
}
}
close(result)
close(internalChan)
}
func OrderedLogDrainer(logs chan (chan string)) chan string {
result := make(chan string)
go waitForLog(logs, result)
return result
}

Лог от изпълнението

PASS
ok  	_/tmp/d20151110-19113-3cshu3	0.019s
PASS
ok  	_/tmp/d20151110-19113-3cshu3	0.389s
PASS
ok  	_/tmp/d20151110-19113-3cshu3	0.118s
PASS
ok  	_/tmp/d20151110-19113-3cshu3	0.009s
--- FAIL: TestWithTwoEmptyLogs (0.50s)
	solution_test.go:27: Test exceeded allowed time of 500 milliseconds
FAIL
exit status 1
FAIL	_/tmp/d20151110-19113-3cshu3	0.507s
PASS
ok  	_/tmp/d20151110-19113-3cshu3	0.881s
--- FAIL: TestTheLimits (0.53s)
	solution_test.go:27: Test exceeded allowed time of 500 milliseconds
FAIL
exit status 1
FAIL	_/tmp/d20151110-19113-3cshu3	0.539s
panic: test timed out after 1s

goroutine 26 [running]:
testing.startAlarm.func1()
	/usr/local/go/src/testing/testing.go:703 +0x132
created by time.goFunc
	/usr/local/go/src/time/sleep.go:129 +0x3a

goroutine 1 [chan receive]:
testing.RunTests(0x5d48c0, 0x65eba0, 0x8, 0x8, 0x1)
	/usr/local/go/src/testing/testing.go:582 +0x558
testing.(*M).Run(0xc82003fef8, 0xc820062510)
	/usr/local/go/src/testing/testing.go:494 +0x70
main.main()
	_/tmp/d20151110-19113-3cshu3/_test/_testmain.go:68 +0x116

goroutine 20 [runnable]:
_/tmp/d20151110-19113-3cshu3.withTimeout(0xc8200a0000, 0x2faf0800, 0xc820084190)
	/tmp/d20151110-19113-3cshu3/solution_test.go:24 +0x262
_/tmp/d20151110-19113-3cshu3.TestWithManyLogs(0xc8200a0000)
	/tmp/d20151110-19113-3cshu3/solution_test.go:272 +0x182
testing.tRunner(0xc8200a0000, 0x65ec48)
	/usr/local/go/src/testing/testing.go:456 +0x98
created by testing.RunTests
	/usr/local/go/src/testing/testing.go:561 +0x86d

goroutine 21 [chan receive]:
testing.RunTests.func1(0xc8200600c0, 0xc8200a0000)
	/usr/local/go/src/testing/testing.go:565 +0x47
created by testing.RunTests
	/usr/local/go/src/testing/testing.go:566 +0x90e

goroutine 22 [chan receive]:
_/tmp/d20151110-19113-3cshu3.TestWithManyLogs.func1()
	/tmp/d20151110-19113-3cshu3/solution_test.go:271 +0x345
_/tmp/d20151110-19113-3cshu3.withTimeout.func1(0xc8200a0000, 0xc8200602a0, 0xc820084190)
	/tmp/d20151110-19113-3cshu3/solution_test.go:21 +0x4e
created by _/tmp/d20151110-19113-3cshu3.withTimeout
	/tmp/d20151110-19113-3cshu3/solution_test.go:22 +0x7c

goroutine 23 [runnable]:
_/tmp/d20151110-19113-3cshu3.waitForLog(0xc820060240, 0xc820060360)
	/tmp/d20151110-19113-3cshu3/solution.go:65 +0x12c
created by _/tmp/d20151110-19113-3cshu3.OrderedLogDrainer
	/tmp/d20151110-19113-3cshu3/solution.go:81 +0x5d

goroutine 25 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200603c0, 0x1, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:35 +0x330
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 3 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e060, 0x2, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 4 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e0c0, 0x3, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 5 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e120, 0x4, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 6 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e180, 0x5, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 7 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e1e0, 0x6, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 8 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e240, 0x7, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 9 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e2a0, 0x8, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 10 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e300, 0x9, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 11 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e360, 0xa, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 12 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e3c0, 0xb, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 13 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e420, 0xc, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 14 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e480, 0xd, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 15 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e4e0, 0xe, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 16 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e540, 0xf, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 33 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e5a0, 0x10, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 34 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e600, 0x11, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 35 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e660, 0x12, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 36 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e6c0, 0x13, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 37 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e720, 0x14, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 38 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e780, 0x15, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 39 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e7e0, 0x16, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 40 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e840, 0x17, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 41 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e8a0, 0x18, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 42 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e900, 0x19, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 43 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e960, 0x1a, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 44 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001e9c0, 0x1b, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 45 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001ea20, 0x1c, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 46 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001ea80, 0x1d, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 47 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001eae0, 0x1e, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 48 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001eb40, 0x1f, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 49 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001eba0, 0x20, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 50 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001ec00, 0x21, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 51 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001ec60, 0x22, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 52 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001ecc0, 0x23, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 53 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001ed20, 0x24, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 54 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001ed80, 0x25, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 55 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001ede0, 0x26, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 56 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001ee40, 0x27, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 57 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001eea0, 0x28, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 58 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001ef00, 0x29, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 59 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001ef60, 0x2a, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 60 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001efc0, 0x2b, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 61 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f020, 0x2c, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 62 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f080, 0x2d, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 63 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f0e0, 0x2e, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 64 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f140, 0x2f, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 65 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f1a0, 0x30, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 66 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f200, 0x31, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 67 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f260, 0x32, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 68 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f2c0, 0x33, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 69 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f320, 0x34, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 70 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f380, 0x35, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 71 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f3e0, 0x36, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 72 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f440, 0x37, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 73 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f4a0, 0x38, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 74 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f500, 0x39, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 75 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f560, 0x3a, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 76 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f5c0, 0x3b, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 77 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f620, 0x3c, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 78 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f680, 0x3d, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 79 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f6e0, 0x3e, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 80 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f740, 0x3f, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 81 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f7a0, 0x40, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 82 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f800, 0x41, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 83 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f860, 0x42, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 84 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f8c0, 0x43, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 85 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f920, 0x44, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 86 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f980, 0x45, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 87 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001f9e0, 0x46, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 88 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001fa40, 0x47, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 89 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001faa0, 0x48, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 90 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001fb00, 0x49, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 91 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001fb60, 0x4a, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 92 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001fbc0, 0x4b, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 93 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001fc20, 0x4c, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 94 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001fc80, 0x4d, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 95 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001fce0, 0x4e, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 96 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001fd40, 0x4f, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 97 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001fda0, 0x50, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 98 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001fe00, 0x51, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 99 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001fe60, 0x52, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 100 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001fec0, 0x53, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 101 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001ff20, 0x54, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 102 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc82001ff80, 0x55, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 103 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da000, 0x56, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 104 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da060, 0x57, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 105 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da0c0, 0x58, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 106 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da120, 0x59, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 107 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da180, 0x5a, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 108 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da1e0, 0x5b, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 109 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da240, 0x5c, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 110 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da2a0, 0x5d, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 111 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da300, 0x5e, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 112 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da360, 0x5f, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 113 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da3c0, 0x60, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 114 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da420, 0x61, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 115 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da480, 0x62, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 116 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da4e0, 0x63, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 117 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da540, 0x64, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 118 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da5a0, 0x65, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 119 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da600, 0x66, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 120 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da660, 0x67, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 121 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da6c0, 0x68, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 122 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da720, 0x69, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 123 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da780, 0x6a, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 124 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da7e0, 0x6b, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 125 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da840, 0x6c, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 126 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da8a0, 0x6d, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 127 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da900, 0x6e, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 128 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da960, 0x6f, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 129 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200da9c0, 0x70, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 130 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200daa20, 0x71, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 131 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200daa80, 0x72, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 132 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200daae0, 0x73, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 133 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200dab40, 0x74, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 134 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200daba0, 0x75, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 135 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200dac00, 0x76, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 136 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200dac60, 0x77, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 137 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200dacc0, 0x78, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 138 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200dad20, 0x79, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 139 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200dad80, 0x7a, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 140 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200dade0, 0x7b, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 141 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200dae40, 0x7c, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 142 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200daea0, 0x7d, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 143 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200daf00, 0x7e, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 144 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200daf60, 0x7f, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 145 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200dafc0, 0x80, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 146 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200db020, 0x81, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 147 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200db080, 0x82, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 148 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200db0e0, 0x83, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 149 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200db140, 0x84, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 150 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200db1a0, 0x85, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 151 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200db200, 0x86, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 152 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200db260, 0x87, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 153 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200db2c0, 0x88, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 154 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200db320, 0x89, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 155 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200db380, 0x8a, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 156 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200db3e0, 0x8b, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 157 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200db440, 0x8c, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 158 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200db4a0, 0x8d, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 159 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200db500, 0x8e, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 160 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200db560, 0x8f, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 161 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200db5c0, 0x90, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 162 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200db620, 0x91, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 163 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200db680, 0x92, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 164 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200db6e0, 0x93, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 165 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200db740, 0x94, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 166 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200db7a0, 0x95, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:14 +0xa0
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 167 [runnable]:
_/tmp/d20151110-19113-3cshu3.handleLog(0xc8200db800, 0x96, 0xc820060360, 0xc820060420)
	/tmp/d20151110-19113-3cshu3/solution.go:24 +0x208
created by _/tmp/d20151110-19113-3cshu3.waitForLog
	/tmp/d20151110-19113-3cshu3/solution.go:60 +0xe8

goroutine 168 [chan receive]:
_/tmp/d20151110-19113-3cshu3.resultChecker.func1(0xc8200a2000, 0x96, 0x96, 0xc820060360, 0xc8200a0000, 0xc8200db860)
	/tmp/d20151110-19113-3cshu3/solution_test.go:36 +0xf2
created by _/tmp/d20151110-19113-3cshu3.resultChecker
	/tmp/d20151110-19113-3cshu3/solution_test.go:48 +0x89
exit status 2
FAIL	_/tmp/d20151110-19113-3cshu3	2.399s

История (2 версии и 0 коментара)

Добромир обнови решението на 10.11.2015 12:10 (преди над 2 години)

+package main
+
+import (
+ "fmt"
+ "strconv"
+)
+
+func handleLog(channel chan string, logNumber int, result chan string, internalChan chan int) {
+ messages := make([]string, 0)
+ channelClosed := false
+ lockTaken := false
+
+ for {
+ select {
+ case message, ok := <-channel:
+ channelClosed = !ok
+ if !channelClosed {
+ messages = append(messages, strconv.Itoa(logNumber)+"\t"+message)
+ }
+ default:
+ }
+ if len(messages) > 0 {
+ if !lockTaken {
+ select {
+ case log, ok := <-internalChan:
+ if log == logNumber && ok {
+ lockTaken = true
+ } else if ok {
+ internalChan <- log
+ }
+ default:
+ lockTaken = false
+ }
+ }
+ if lockTaken {
+ select {
+ case result <- messages[0]:
+ messages = messages[1:]
+ default:
+ }
+ }
+ }
+ if channelClosed && len(messages) == 0 {
+ if lockTaken {
+ internalChan <- logNumber + 1
+ }
+ return
+ }
+ }
+}
+
+func waitForLog(logs chan (chan string), result chan string) {
+ logCount := 1
+ internalChan := make(chan int)
+ lockTaken := false
+
+ go func(channel chan int) {
+ channel <- 1
+ }(internalChan)
+
+ for log := range logs {
+ go handleLog(log, logCount, result, internalChan)
+ logCount += 1
+ }
+ for !lockTaken {
+ select {
+ case log, ok := <-internalChan:
+ if log == logCount && ok {
+ lockTaken = true
+ } else if ok {
+ internalChan <- log
+ }
+ default:
+ lockTaken = false
+ }
+ }
+ close(result)
+ close(internalChan)
+}
+
+func OrderedLogDrainer(logs chan (chan string)) chan string {
+ result := make(chan string)
+ go waitForLog(logs, result)
+ return result
+}
+
+func main() {
+ logs := make(chan (chan string))
+ orderedLog := OrderedLogDrainer(logs)
+
+ first := make(chan string)
+ logs <- first
+ second := make(chan string)
+ logs <- second
+
+ first <- "test message 1 in first"
+ second <- "test message 1 in second"
+ second <- "test message 2 in second"
+ first <- "test message 2 in first"
+ first <- "test message 3 in first"
+ // Print the first message now just because we can
+ fmt.Println(<-orderedLog)
+
+ third := make(chan string)
+ logs <- third
+
+ third <- "test message 1 in third"
+ first <- "test message 4 in first"
+ close(first)
+ second <- "test message 3 in second"
+ close(third)
+ close(logs)
+
+ second <- "test message 4 in second"
+ close(second)
+
+ // Print all the rest of the messages
+ for logEntry := range orderedLog {
+ fmt.Println(logEntry)
+ }
+}

Добромир обнови решението на 10.11.2015 12:14 (преди над 2 години)

package main
import (
- "fmt"
"strconv"
)
func handleLog(channel chan string, logNumber int, result chan string, internalChan chan int) {
messages := make([]string, 0)
channelClosed := false
lockTaken := false
for {
select {
case message, ok := <-channel:
channelClosed = !ok
if !channelClosed {
messages = append(messages, strconv.Itoa(logNumber)+"\t"+message)
}
default:
}
if len(messages) > 0 {
if !lockTaken {
select {
case log, ok := <-internalChan:
if log == logNumber && ok {
lockTaken = true
} else if ok {
internalChan <- log
}
default:
lockTaken = false
}
- }
- if lockTaken {
+ } else {
select {
case result <- messages[0]:
messages = messages[1:]
default:
}
}
}
if channelClosed && len(messages) == 0 {
if lockTaken {
internalChan <- logNumber + 1
}
return
}
}
}
func waitForLog(logs chan (chan string), result chan string) {
logCount := 1
internalChan := make(chan int)
lockTaken := false
go func(channel chan int) {
channel <- 1
}(internalChan)
for log := range logs {
go handleLog(log, logCount, result, internalChan)
logCount += 1
}
for !lockTaken {
select {
case log, ok := <-internalChan:
if log == logCount && ok {
lockTaken = true
} else if ok {
internalChan <- log
}
default:
lockTaken = false
}
}
close(result)
close(internalChan)
}
func OrderedLogDrainer(logs chan (chan string)) chan string {
result := make(chan string)
go waitForLog(logs, result)
return result
-}
-
-func main() {
- logs := make(chan (chan string))
- orderedLog := OrderedLogDrainer(logs)
-
- first := make(chan string)
- logs <- first
- second := make(chan string)
- logs <- second
-
- first <- "test message 1 in first"
- second <- "test message 1 in second"
- second <- "test message 2 in second"
- first <- "test message 2 in first"
- first <- "test message 3 in first"
- // Print the first message now just because we can
- fmt.Println(<-orderedLog)
-
- third := make(chan string)
- logs <- third
-
- third <- "test message 1 in third"
- first <- "test message 4 in first"
- close(first)
- second <- "test message 3 in second"
- close(third)
- close(logs)
-
- second <- "test message 4 in second"
- close(second)
-
- // Print all the rest of the messages
- for logEntry := range orderedLog {
- fmt.Println(logEntry)
- }
}