mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-02-16 05:09:29 -06:00
fix: examples
This commit is contained in:
@@ -54,7 +54,7 @@ func emit(ctx context.Context, startEventsPerSecond, amount int, increase, durat
|
||||
var err error
|
||||
ev := Event{CreatedAt: time.Now(), ID: id}
|
||||
l.Debug().Msgf("pushed event %d", ev.ID)
|
||||
err = c.Event().Push(context.Background(), "load-test:event", ev)
|
||||
err = c.Event().Push(context.Background(), "load-test:event", ev, nil, nil)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("error pushing event: %w", err))
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ func event() {
|
||||
v1_workflows.SimpleInput{
|
||||
Message: "Hello, World!",
|
||||
},
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
// !!
|
||||
|
||||
|
||||
@@ -89,6 +89,8 @@ func run() (func() error, error) {
|
||||
context.Background(),
|
||||
"user:create:affinity",
|
||||
testEvent,
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("error pushing event: %w", err))
|
||||
|
||||
@@ -111,6 +111,8 @@ func run() (func() error, error) {
|
||||
context.Background(),
|
||||
"user:create:sticky",
|
||||
testEvent,
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("error pushing event: %w", err))
|
||||
|
||||
@@ -69,6 +69,8 @@ func run(events chan<- string) (func() error, error) {
|
||||
context.Background(),
|
||||
"user:create:cancellation",
|
||||
testEvent,
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("error pushing event: %w", err))
|
||||
|
||||
@@ -141,6 +141,8 @@ func run(events chan<- string) (func() error, error) {
|
||||
context.Background(),
|
||||
"user:create:simple",
|
||||
testEvent,
|
||||
nil,
|
||||
nil,
|
||||
client.WithEventMetadata(map[string]string{
|
||||
"hello": "world",
|
||||
}),
|
||||
|
||||
@@ -150,6 +150,8 @@ func run(ch <-chan interface{}, events chan<- string) error {
|
||||
context.Background(),
|
||||
"user:create:simple",
|
||||
testEvent,
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -59,6 +59,8 @@ func main() {
|
||||
context.Background(),
|
||||
"example:event",
|
||||
event,
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -35,6 +35,8 @@ func main() {
|
||||
context.Background(),
|
||||
"user:create",
|
||||
event,
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -69,6 +69,8 @@ func main() {
|
||||
context.Background(),
|
||||
"user:create",
|
||||
event,
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -97,6 +97,8 @@ func main() {
|
||||
context.Background(),
|
||||
"user:create",
|
||||
testEvent,
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -112,6 +112,8 @@ func main() {
|
||||
context.Background(),
|
||||
"user:create",
|
||||
testEvent,
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -103,6 +103,8 @@ func run(ch <-chan interface{}, events chan<- string) error {
|
||||
context.Background(),
|
||||
"concurrency-test-event",
|
||||
firstEvent,
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
@@ -123,6 +125,8 @@ func run(ch <-chan interface{}, events chan<- string) error {
|
||||
concurrencyLimitEvent{
|
||||
Index: 1,
|
||||
},
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -120,7 +120,13 @@ func run(ch <-chan interface{}, events chan<- string) error {
|
||||
event = concurrencyLimitEvent{1}
|
||||
}
|
||||
|
||||
c.Event().Push(context.Background(), "concurrency-test-event-rr", event)
|
||||
c.Event().Push(
|
||||
context.Background(),
|
||||
"concurrency-test-event-rr",
|
||||
event,
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
}
|
||||
|
||||
select {
|
||||
|
||||
@@ -109,6 +109,8 @@ func run(events chan<- string) (func() error, error) {
|
||||
context.Background(),
|
||||
"user:log:simple",
|
||||
testEvent,
|
||||
nil,
|
||||
nil,
|
||||
client.WithEventMetadata(map[string]string{
|
||||
"hello": "world",
|
||||
}),
|
||||
|
||||
@@ -118,6 +118,8 @@ func run(events chan<- string) (func() error, error) {
|
||||
context.Background(),
|
||||
"user:create:middleware",
|
||||
testEvent,
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("error pushing event: %w", err))
|
||||
|
||||
@@ -128,6 +128,8 @@ func run(events chan<- string) (func() error, error) {
|
||||
context.Background(),
|
||||
"user:create:simple",
|
||||
testEvent,
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("error pushing event: %w", err))
|
||||
|
||||
@@ -136,6 +136,8 @@ func main() {
|
||||
context.Background(),
|
||||
"user:create",
|
||||
testEvent,
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -118,6 +118,8 @@ func run(ch <-chan interface{}, events chan<- string) error {
|
||||
context.Background(),
|
||||
"user:create:simple",
|
||||
testEvent,
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -120,6 +120,8 @@ func run(events chan<- string) (func() error, error) {
|
||||
context.Background(),
|
||||
"user:create:simple",
|
||||
testEvent,
|
||||
nil,
|
||||
nil,
|
||||
client.WithEventMetadata(map[string]string{
|
||||
"hello": "world",
|
||||
}),
|
||||
|
||||
@@ -49,6 +49,8 @@ func run(done chan<- string, job worker.WorkflowJob) (func() error, error) {
|
||||
context.Background(),
|
||||
"user:create:timeout",
|
||||
testEvent,
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("error pushing event: %w", err))
|
||||
|
||||
@@ -72,6 +72,8 @@ func run(
|
||||
context.Background(),
|
||||
event,
|
||||
testEvent,
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error pushing event: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user