Skip to content

Commit

Permalink
Add more verbose logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Ignatov authored and Vladislav Alekseev committed Jun 21, 2020
1 parent 499adc7 commit bdf3b2f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public class DefaultQueueCommunicationService: QueueCommunicationService {
deployments: [DeploymentDestination],
completion: @escaping (Either<Set<WorkerId>, Error>) -> ()
) {
Logger.debug("Making request for workers to utilize. Version: \(version), deployments: \(deployments) ")
do {
let masterPort = try remoteQueueDetector.findMasterQueuePort(timeout: requestTimeout)
Logger.debug("Found master queue port: \(masterPort)")

let requestSender = requestSenderProvider.requestSender(
socketAddress: SocketAddress(host: socketHost, port: masterPort)
Expand Down
8 changes: 5 additions & 3 deletions Sources/QueueCommunication/DefaultRemoteQueueDetector.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Foundation
import RemotePortDeterminer
import Logging
import Models
import RemotePortDeterminer

public enum RemoteQueueDetectorError: Error, CustomStringConvertible {
case noMasterQueueFound
Expand Down Expand Up @@ -41,10 +42,11 @@ public final class DefaultRemoteQueueDetector: RemoteQueueDetector {
left.value > right.value
}

guard let masterPort = sortedQueues.first?.key else {
guard let masterQueue = sortedQueues.first else {
throw RemoteQueueDetectorError.noMasterQueueFound
}

return masterPort
Logger.debug("Found master queue with version \(masterQueue.value) at port \(masterQueue.key)")
return masterQueue.key
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class DefaultWorkerUtilizationStatusPoller: WorkerUtilizationStatusPoller

public func startPolling() {
pollingTrigger.start { [weak self] timer in
Logger.debug("Fetching workers to utilize")
self?.fetchWorkersToUtilize()
}
}
Expand Down Expand Up @@ -64,7 +65,7 @@ public class DefaultWorkerUtilizationStatusPoller: WorkerUtilizationStatusPoller
)
)
} catch {
Logger.error(error.localizedDescription)
Logger.error("Error in fetching workers to utilze: \(error.localizedDescription)")
}
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public final class ToggleWorkersSharingEndpoint: RESTEndpoint {
}

public func handle(payload: ToggleWorkersSharingPayload) throws -> VoidPayload {
Logger.debug("Change workers sharing feature state to :\(payload.status)")

switch payload.status {
case .disabled:
poller.stopPollingAndRestoreDefaultConfig()
Expand Down

0 comments on commit bdf3b2f

Please sign in to comment.