Skip to content

Commit

Permalink
Derefernce MembershipTasks for sendAlert goroutine
Browse files Browse the repository at this point in the history
  • Loading branch information
iknite committed Dec 18, 2018
1 parent 6e4f989 commit 29a911f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion gossip/auditor/auditor.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ type MembershipTask struct {
s *protocol.SignedSnapshot
}

func (t *MembershipTask) Do() {
func (t MembershipTask) Do() {
proof, err := t.qed.MembershipDigest(t.s.Snapshot.EventDigest, t.s.Snapshot.Version)
if err != nil {
// retry
Expand Down
10 changes: 5 additions & 5 deletions gossip/monitor/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type Monitor struct {
client *client.HttpClient
conf *Config

taskCh chan *QueryTask
taskCh chan QueryTask
quitCh chan bool
executionTicker *time.Ticker
}
Expand All @@ -60,7 +60,7 @@ func NewMonitor(conf *Config) (*Monitor, error) {
monitor := &Monitor{
client: client,
conf: conf,
taskCh: make(chan *QueryTask, 100),
taskCh: make(chan QueryTask, 100),
quitCh: make(chan bool),
}

Expand All @@ -81,7 +81,7 @@ func (m Monitor) Process(b *protocol.BatchSnapshots) {

log.Debugf("Processing batch from versions %d to %d", first.Version, last.Version)

task := &QueryTask{
task := QueryTask{
Start: first.Version,
End: last.Version,
StartSnapshot: first,
Expand Down Expand Up @@ -113,12 +113,12 @@ func (m *Monitor) Shutdown() {

func (m *Monitor) dispatchTasks() {
count := 0
var task *QueryTask
var task QueryTask
defer log.Debugf("%d tasks dispatched", count)
for {
select {
case task = <-m.taskCh:
go m.executeTask(*task)
go m.executeTask(task)
count++
default:
return
Expand Down
4 changes: 2 additions & 2 deletions gossip/publisher/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (p *Publisher) dispatchTasks() {
for {
select {
case task = <-p.taskCh:
go p.executeTask(&task)
go p.executeTask(task)
count++
default:
return
Expand All @@ -120,7 +120,7 @@ func (p *Publisher) dispatchTasks() {
}
}

func (p *Publisher) executeTask(task *PublishTask) {
func (p *Publisher) executeTask(task PublishTask) {
log.Debug("Executing task: %+v\n", task)
buf, err := task.Batch.Encode()
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/

package e2e

import (
Expand Down

0 comments on commit 29a911f

Please sign in to comment.