Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
eikemeier committed Mar 7, 2024
1 parent bf7991f commit 6644301
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 30 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[![Maintainability](https://api.codeclimate.com/v1/badges/2ba503a6a37cfc77951c/maintainability)](https://codeclimate.com/github/fillmore-labs/microbatch/maintainability)
[![Go Report Card](https://goreportcard.com/badge/fillmore-labs.com/microbatch)](https://goreportcard.com/report/fillmore-labs.com/microbatch)
[![License](https://img.shields.io/github/license/fillmore-labs/microbatch)](https://github.com/fillmore-labs/microbatch/blob/main/LICENSE)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Ffillmore-labs%2Fmicrobatch.svg?type=shield&issueType=license)](https://app.fossa.com/projects/git%2Bgithub.com%2Ffillmore-labs%2Fmicrobatch?ref=badge_shield&issueType=license)

Micro-batching is a technique often used in stream processing to achieve near real-time computation while reducing the
overhead compared to single record processing.
Expand Down
12 changes: 6 additions & 6 deletions batcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,22 @@ func (s *BatcherTestSuite) TestBatcher() {
s.BatchProcessor.EXPECT().ProcessJobs(mock.Anything).Return(returned, nil).Once()

// when
futures := make(promise.List[string], iterations)
futures := make([]promise.Future[string], iterations)
for i := 0; i < iterations; i++ {
futures[i] = s.Batcher.Submit(i + 1)
}
s.Batcher.Send()

ctx := context.Background()
results, err := futures.AwaitAllValues(ctx)
results, err := promise.AwaitAllValues(ctx, futures...)

s.Batcher.Send()

// then
s.NoErrorf(err, "Unexpected error executing jobs")

expected := makeResults(iterations)
s.Equal(expected, results)
if s.NoErrorf(err, "Unexpected error executing jobs") {
expected := makeResults(iterations)
s.Equal(expected, results)
}
}

func makeResults(iterations int) []string {
Expand Down
10 changes: 6 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ module fillmore-labs.com/microbatch

go 1.21

toolchain go1.22.0
toolchain go1.22.1

require (
fillmore-labs.com/promise v0.0.1
github.com/stretchr/testify v1.8.4
fillmore-labs.com/promise v0.0.2
github.com/stretchr/testify v1.9.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/objx v0.5.1 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
31 changes: 13 additions & 18 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
fillmore-labs.com/promise v0.0.1 h1:0x8iGratHHISYcPBSLucx0gpml3JkXlKuD++uKWzoQ4=
fillmore-labs.com/promise v0.0.1/go.mod h1:mDX+bgUyPpTXPNaKq2b+YK2lo2YCLV3n+QDGhKjJSCQ=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
fillmore-labs.com/promise v0.0.2 h1:DocbRu3sgTgGmrnh5Mn0/Ea5W7/T0LPujm734z8zhCc=
fillmore-labs.com/promise v0.0.2/go.mod h1:uRXW66RLl25mQXnTaEIyJOxckSkmHw+AfqwiU1/j38A=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.1 h1:4VhoImhV/Bm0ToFkXFi8hXNXwpDRZ/ynw3amt82mzq0=
github.com/stretchr/objx v0.5.1/go.mod h1:/iHQpkQwBD6DLUmQ4pE+s1TXdob1mORJ4/UFdrifcy0=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
4 changes: 2 additions & 2 deletions internal/processor/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ func (s *ProcessorTestSuite) TestProcessorDuplicateUncorrelated() {
}
}

func makeRequestsResults[Q, R any](ids []Q) ([]internal.BatchRequest[Q, R], promise.List[R]) {
func makeRequestsResults[Q, R any](ids []Q) ([]internal.BatchRequest[Q, R], []promise.Future[R]) {
requests := make([]internal.BatchRequest[Q, R], len(ids))
results := make(promise.List[R], len(ids))
results := make([]promise.Future[R], len(ids))
for i, id := range ids {
p, f := promise.New[R]()
requests[i] = internal.BatchRequest[Q, R]{Request: id, Result: p}
Expand Down

0 comments on commit 6644301

Please sign in to comment.