Browse Source

En cours de développement

master
losyme 2 months ago
parent
commit
db762d885f
  1. 1
      internal/demo/demo.go
  2. 27
      internal/demo/jw.go

1
internal/demo/demo.go

@ -40,6 +40,7 @@ func New(namespace string, logger *logger.Component, model runner.Model) (*Demo,
"succeeded": demo.succeeded,
"failed": demo.failed,
"panic": demo.panic,
"pending": demo.pending,
}
for jt, jh := range handlers {

27
internal/demo/jw.go

@ -6,7 +6,11 @@
package demo
import "forge.chapril.org/dune/sdk/runner"
import (
"time"
"forge.chapril.org/dune/sdk/runner"
)
func (d *Demo) succeeded(_ *runner.Job) {
// nothing to do
@ -20,6 +24,27 @@ func (d *Demo) panic(_ *runner.Job) {
panic("it's only a test") //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
}
func (d *Demo) pending(job *runner.Job) {
v, ok := job.Private["count"]
if ok {
count, ok := v.(int)
if ok {
if count == 3 {
// end
return
}
job.SetPrivate("count", count+1)
} else {
job.Failed().SetError("unexpected error")
}
} else {
job.SetPrivate("count", 0)
}
job.Pending().SetDuration(2 * time.Second)
}
/*
######################################################################################################## @(°_°)@ #######
*/

Loading…
Cancel
Save