From 51723c5d7043a11b5215507203b97823701fe2b7 Mon Sep 17 00:00:00 2001
From: Hans Moog <hm@mkjc.net>
Date: Wed, 24 Jul 2019 11:42:13 +0200
Subject: [PATCH] Refactor: made request processor use timeutils

---
 .../autopeering/protocol/outgoing_request_processor.go    | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/plugins/autopeering/protocol/outgoing_request_processor.go b/plugins/autopeering/protocol/outgoing_request_processor.go
index 31fb40cf..88b95669 100644
--- a/plugins/autopeering/protocol/outgoing_request_processor.go
+++ b/plugins/autopeering/protocol/outgoing_request_processor.go
@@ -3,6 +3,8 @@ package protocol
 import (
 	"time"
 
+	"github.com/iotaledger/goshimmer/packages/timeutil"
+
 	"github.com/iotaledger/goshimmer/packages/accountability"
 	"github.com/iotaledger/goshimmer/packages/daemon"
 	"github.com/iotaledger/goshimmer/packages/node"
@@ -41,11 +43,7 @@ func createOutgoingRequestProcessor(plugin *node.Plugin) func() {
 
 func sendOutgoingRequests(plugin *node.Plugin) {
 	for _, chosenNeighborCandidate := range chosenneighbors.CANDIDATES.Clone() {
-		select {
-		case <-daemon.ShutdownSignal:
-			return
-		case <-time.After(5 * time.Second):
-		}
+		timeutil.Sleep(5 * time.Second)
 
 		if candidateShouldBeContacted(chosenNeighborCandidate) {
 			if dialed, err := chosenNeighborCandidate.Send(outgoingrequest.INSTANCE.Marshal(), types.PROTOCOL_TYPE_TCP, true); err != nil {
-- 
GitLab