Skip to content

Commit

Permalink
Merge pull request #11 from go-zoox/feat/context-add-create-concurren…
Browse files Browse the repository at this point in the history
…cy-method

feat: context add create concurrency method
  • Loading branch information
whatwewant authored Aug 20, 2023
2 parents e436980 + f42c08f commit b87e5ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
"github.com/go-zoox/zoox/components/context/user"
"github.com/go-zoox/zoox/utils"

"github.com/go-zoox/concurrency"
"github.com/go-zoox/cookie"
"github.com/go-zoox/core-utils/safe"
"github.com/go-zoox/fetch"
Expand Down Expand Up @@ -922,3 +923,8 @@ func (ctx *Context) Publish(msg *pubsub.Message) error {
func (ctx *Context) Subscribe(topic string, handler pubsub.Handler) error {
return ctx.App.PubSub().Subscribe(ctx.Context(), topic, handler)
}

// Concurrency creates a concurrency.
func (ctx *Context) Concurrency(limit int) *concurrency.Concurrency {
return concurrency.New(limit)
}
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.20

require (
github.com/go-zoox/cache v1.0.3
github.com/go-zoox/concurrency v1.2.0
github.com/go-zoox/cookie v1.2.0
github.com/go-zoox/core-utils v1.2.13
github.com/go-zoox/counter v1.2.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ github.com/go-zoox/chalk v1.0.2 h1:DCWft37fogmvqF37JdbGSLg28L/tQeA8u0lMvb62KOg=
github.com/go-zoox/chalk v1.0.2/go.mod h1:z5+qvE9nEJI5uT4px2tyoFa/xxkqf3CUo22KmXLKbNI=
github.com/go-zoox/compress v1.0.1 h1:EyNxo5NscMLua5fvUdiGSF+BwhuTfMeyppu7OwKAW7Q=
github.com/go-zoox/compress v1.0.1/go.mod h1:iV6CcNulf3OuEfA1h1VOsaBqYH81cVSg5wNi5HDx2h4=
github.com/go-zoox/concurrency v1.2.0 h1:iucwSWQ0Y9fFIG+eZvyHjMrIPSnaKJTGfOcGbIx91yg=
github.com/go-zoox/concurrency v1.2.0/go.mod h1:rghauUPHEDp8HJzaVlU851HWqiAqD8lUVp45K/dtNvw=
github.com/go-zoox/cookie v1.2.0 h1:MO33lPQ/QGJIAEzgrsAfEpJc25lcJ/XR0w+smM19sNQ=
github.com/go-zoox/cookie v1.2.0/go.mod h1:+xEawxty0L+z+4EIvTF2AaHUkUM7oIecGZ9XrEaYqsI=
github.com/go-zoox/core-utils v1.0.4/go.mod h1:EknM3KLL6/kagL95wZbWE7mRRcYCG/fHqiJ/EH0ihAs=
Expand Down

0 comments on commit b87e5ed

Please sign in to comment.