Skip to content

Commit

Permalink
Trigger all async tasks in a separate goroutine. (#2332)
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrm50 authored Jul 14, 2022
1 parent f186140 commit 26d701b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/gin-gonic/gin v1.7.0
github.com/go-resty/resty/v2 v2.6.0
github.com/gorilla/websocket v1.5.0
github.com/iotaledger/hive.go v0.0.0-20220705110659-84be3e28c8ce
github.com/iotaledger/hive.go v0.0.0-20220714071841-4f9c6ffe833a
github.com/labstack/echo v3.3.10+incompatible
github.com/labstack/gommon v0.3.0
github.com/libp2p/go-libp2p v0.15.0
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,12 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
github.com/iotaledger/hive.go v0.0.0-20220705110659-84be3e28c8ce h1:r6nyywvjxrFwC6qE9NcU/cWaLL8XWyzPtvQ0UfYGGmE=
github.com/iotaledger/hive.go v0.0.0-20220705110659-84be3e28c8ce/go.mod h1:8f9U7qHFby0W3cxv/nKnz9LHn9BbwWU0tMsWDnfqzRI=
github.com/iotaledger/hive.go v0.0.0-20220713131416-10a47a2d9944 h1:ARmT1GEX1XxOah061u7AXsnegFqYsRu/rge5fuBINts=
github.com/iotaledger/hive.go v0.0.0-20220713131416-10a47a2d9944/go.mod h1:8f9U7qHFby0W3cxv/nKnz9LHn9BbwWU0tMsWDnfqzRI=
github.com/iotaledger/hive.go v0.0.0-20220714061633-953e10f60c45 h1:tKgADjyZLNzcI5/pd/oW3rhcvGPq9yYODjqwrltqw2M=
github.com/iotaledger/hive.go v0.0.0-20220714061633-953e10f60c45/go.mod h1:8f9U7qHFby0W3cxv/nKnz9LHn9BbwWU0tMsWDnfqzRI=
github.com/iotaledger/hive.go v0.0.0-20220714071841-4f9c6ffe833a h1:052kOYS5MjFWQrbS3mRzWERRrxAgXaZQBjDQRsWxWNU=
github.com/iotaledger/hive.go v0.0.0-20220714071841-4f9c6ffe833a/go.mod h1:8f9U7qHFby0W3cxv/nKnz9LHn9BbwWU0tMsWDnfqzRI=
github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
Expand Down
6 changes: 3 additions & 3 deletions packages/notarization/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ func (m *Manager) OnTransactionInclusionUpdated(event *ledger.TransactionInclusi
// OnConflictConfirmed is the handler for conflict confirmed event.
func (m *Manager) OnConflictConfirmed(conflictID utxo.TransactionID) {
epochCommittableEvents, manaVectorUpdateEvents := m.onConflictConfirmed(conflictID)
go m.triggerEpochEvents(epochCommittableEvents, manaVectorUpdateEvents)
m.triggerEpochEvents(epochCommittableEvents, manaVectorUpdateEvents)
}

// OnConflictConfirmed is the handler for conflict confirmed event.
Expand Down Expand Up @@ -329,7 +329,7 @@ func (m *Manager) OnConflictCreated(conflictID utxo.TransactionID) {
// OnConflictRejected is the handler for conflict created event.
func (m *Manager) OnConflictRejected(conflictID utxo.TransactionID) {
epochCommittableEvents, manaVectorUpdateEvents := m.onConflictRejected(conflictID)
go m.triggerEpochEvents(epochCommittableEvents, manaVectorUpdateEvents)
m.triggerEpochEvents(epochCommittableEvents, manaVectorUpdateEvents)
}

// OnConflictRejected is the handler for conflict created event.
Expand All @@ -349,7 +349,7 @@ func (m *Manager) onConflictRejected(conflictID utxo.TransactionID) ([]*EpochCom
// OnAcceptanceTimeUpdated is the handler for time updated event and triggers the events.
func (m *Manager) OnAcceptanceTimeUpdated(newTime time.Time) {
epochCommittableEvents, manaVectorUpdateEvents := m.onAcceptanceTimeUpdated(newTime)
go m.triggerEpochEvents(epochCommittableEvents, manaVectorUpdateEvents)
m.triggerEpochEvents(epochCommittableEvents, manaVectorUpdateEvents)
}

// OnAcceptanceTimeUpdated is the handler for time updated event and returns events to be triggered.
Expand Down
2 changes: 1 addition & 1 deletion tools/integration-tests/tester/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/docker/docker v1.13.1
github.com/docker/go-connections v0.4.0
github.com/iotaledger/goshimmer v0.1.3
github.com/iotaledger/hive.go v0.0.0-20220705110659-84be3e28c8ce
github.com/iotaledger/hive.go v0.0.0-20220714071841-4f9c6ffe833a
github.com/mr-tron/base58 v1.2.0
github.com/stretchr/testify v1.7.1
golang.org/x/crypto v0.0.0-20220214200702-86341886e292
Expand Down
9 changes: 8 additions & 1 deletion tools/integration-tests/tester/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -418,12 +418,13 @@ github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmv
github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE=
github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-blkpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI=
github.com/hashicorp/go-hclog v0.8.0/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-blkpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-plugin v1.0.1/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY=
github.com/hashicorp/go-retryablehttp v0.5.4/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
Expand Down Expand Up @@ -465,6 +466,12 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
github.com/iotaledger/hive.go v0.0.0-20220705110659-84be3e28c8ce h1:r6nyywvjxrFwC6qE9NcU/cWaLL8XWyzPtvQ0UfYGGmE=
github.com/iotaledger/hive.go v0.0.0-20220705110659-84be3e28c8ce/go.mod h1:8f9U7qHFby0W3cxv/nKnz9LHn9BbwWU0tMsWDnfqzRI=
github.com/iotaledger/hive.go v0.0.0-20220713131416-10a47a2d9944 h1:ARmT1GEX1XxOah061u7AXsnegFqYsRu/rge5fuBINts=
github.com/iotaledger/hive.go v0.0.0-20220713131416-10a47a2d9944/go.mod h1:8f9U7qHFby0W3cxv/nKnz9LHn9BbwWU0tMsWDnfqzRI=
github.com/iotaledger/hive.go v0.0.0-20220714061633-953e10f60c45 h1:tKgADjyZLNzcI5/pd/oW3rhcvGPq9yYODjqwrltqw2M=
github.com/iotaledger/hive.go v0.0.0-20220714061633-953e10f60c45/go.mod h1:8f9U7qHFby0W3cxv/nKnz9LHn9BbwWU0tMsWDnfqzRI=
github.com/iotaledger/hive.go v0.0.0-20220714071841-4f9c6ffe833a h1:052kOYS5MjFWQrbS3mRzWERRrxAgXaZQBjDQRsWxWNU=
github.com/iotaledger/hive.go v0.0.0-20220714071841-4f9c6ffe833a/go.mod h1:8f9U7qHFby0W3cxv/nKnz9LHn9BbwWU0tMsWDnfqzRI=
github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
Expand Down

0 comments on commit 26d701b

Please sign in to comment.