Skip to content

Feat engine worker recover

Florent Peterschmitt requested to merge feat-engine-worker-recover into develop

TODO :

  • Conserver la stacktrace après recover pour pouvoir tracer le bug : https://golang.org/pkg/runtime/debug/#Stack
  • Faire la même chose pour PeriodicalProcess.
  • Doc des méthodes supplémentaires de l’interface DefaultEngine.
  • Mettre le code d’exemple sous forme de test.

Pour tester :

go test -test.run "Test.*PanicEngine" -test.v .

Le rendu :

=== RUN   TestPanicEngine

  Setup panic engine 2018/03/19 09:56:40 Engine started
2018/03/19 09:56:40 pwet0
2018/03/19 09:56:41 pwet1
2018/03/19 09:56:42 periodical coucou
2018/03/19 09:56:42 pwet2
2018/03/19 09:56:43 pwet3
2018/03/19 09:56:44 periodical coucou
2018/03/19 09:56:44 worker recovered from panic: jepanikay
goroutine 4 [running]:
runtime/debug.Stack(0xc4200a8140, 0x2, 0xc42002a0f0)
        /usr/lib/go/src/runtime/debug/stack.go:24 +0xa7
runtime/debug.PrintStack()
        /usr/lib/go/src/runtime/debug/stack.go:16 +0x22
git.canopsis.net/canopsis/go-revolution/canopsis.(*DefaultEngine).RecoverWorker(0xc4200aac00)
        /home/wrk/doc/go/src/git.canopsis.net/canopsis/go-revolution/canopsis/engine.go:228 +0x94
panic(0x822c60, 0x925db0)
        /usr/lib/go/src/runtime/panic.go:505 +0x229
git.canopsis.net/canopsis/go-revolution/canopsis_test.(*PanicEngine).WorkerProcess(0xc4200aac00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/wrk/doc/go/src/git.canopsis.net/canopsis/go-revolution/canopsis/engine_test.go:211 +0x132
git.canopsis.net/canopsis/go-revolution/canopsis.routineWorker(0x931760, 0xc4200aac00, 0xc420076060)
        /home/wrk/doc/go/src/git.canopsis.net/canopsis/go-revolution/canopsis/engine.go:237 +0x144
created by git.canopsis.net/canopsis/go-revolution/canopsis.StartEngine
        /home/wrk/doc/go/src/git.canopsis.net/canopsis/go-revolution/canopsis/engine.go:207 +0x1a4
2018/03/19 09:56:44 engine stop called, waiting for processes to finish.



1 total assertion

--- PASS: TestPanicEngine (6.00s)
PASS
ok      git.canopsis.net/canopsis/go-revolution/canopsis        6.004s

@adewarumez @bdubois @rhennuyer @tgosselin @dwatteau

Edited by Florent Peterschmitt

Merge request reports