Skip to content

Commit

Permalink
Debounce (#30)
Browse files Browse the repository at this point in the history
* Add timeout debounce config, allow empty keys

* Vendor
  • Loading branch information
tonyhb authored Jan 8, 2024
1 parent 41526b6 commit 4b598cb
Show file tree
Hide file tree
Showing 938 changed files with 46,973 additions and 279,909 deletions.
10 changes: 9 additions & 1 deletion funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,16 @@ func (f FunctionOpts) GetRateLimit() *inngest.RateLimit {
// Debounce represents debounce configuration used when creating a new function within
// FunctionOpts
type Debounce struct {
Key string `json:"key"`
// Key is an optional expression to use for constraining the debounce to a given
// value.
Key string `json:"key,omitempty"`
// Period is how long to listen for new events matching the optional key. Any event
// received during this period will reschedule the debounce to run after another period
// interval.
Period time.Duration `json:"period"`
// Timeout specifies the optional max lifetime of a debounce, ensuring that functions
// run after the given duration when a debounce is rescheduled indefinitely.
Timeout *time.Duration `json:"timeout,omitempty"`
}

type RateLimit struct {
Expand Down
38 changes: 13 additions & 25 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,61 +1,49 @@
module github.com/inngest/inngestgo

go 1.21

toolchain go1.21.0
go 1.21.0

replace github.com/tencentcloud/tencentcloud-sdk-go v3.0.82+incompatible => github.com/tencentcloud/tencentcloud-sdk-go v1.0.191

require (
github.com/gosimple/slug v1.12.0
github.com/gowebpki/jcs v1.0.0
github.com/inngest/inngest v0.22.1-0.20231130083256-91d7e2c9664f
github.com/inngest/inngest v0.23.2-0.20240108184544-5424b5936b1a
github.com/stretchr/testify v1.8.4
github.com/xhit/go-str2duration/v2 v2.1.0
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df
)

require (
github.com/agext/levenshtein v1.2.2 // indirect
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20220418222510-f25a4f6275ed // indirect
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dustinkirkland/golang-petname v0.0.0-20191129215211-8e5a1ed0cff0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/google/cel-go v0.11.4 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/google/cel-go v0.18.2 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/gosimple/unidecode v1.0.1 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-hclog v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/hcl/v2 v2.10.0 // indirect
github.com/hashicorp/terraform v0.15.3 // indirect
github.com/inngest/expr v0.0.0-20240106161226-5bf5dca4ded5 // indirect
github.com/karlseguin/ccache/v2 v2.0.8 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/ohler55/ojg v1.21.0 // indirect
github.com/oklog/ulid/v2 v2.1.0 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/plar/go-adaptive-radix-tree v1.0.5 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/rs/zerolog v1.26.1 // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.10.1 // indirect
github.com/stoewer/go-strcase v1.2.0 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/zclconf/go-cty v1.8.3 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230815205213-6bfd019c3878 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230815205213-6bfd019c3878 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231127180814-3a041ad873d4 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.66.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
93 changes: 30 additions & 63 deletions go.sum

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ func (h *handler) register(w http.ResponseWriter, r *http.Request) error {
Key: &c.Debounce.Key,
Period: c.Debounce.Period.String(),
}
if c.Debounce.Timeout != nil {
str := c.Debounce.Timeout.String()
f.Debounce.Timeout = &str
}
}

if c.BatchEvents != nil {
Expand Down
26 changes: 0 additions & 26 deletions vendor/github.com/antlr/antlr4/runtime/Go/antlr/LICENSE

This file was deleted.

Loading

0 comments on commit 4b598cb

Please sign in to comment.