Merge pull request #25744 from akka/dontWarnAboutOldProtocolUse

Don't warn about old DNS protocol use
This commit is contained in:
Patrik Nordwall 2018-10-15 13:37:10 +02:00 committed by GitHub
commit af240d77aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,7 +70,6 @@ private[io] final class AsyncDnsManager(val ext: DnsExt) extends Actor
case Dns.Resolve(name) case Dns.Resolve(name)
// adapt legacy protocol to new protocol // adapt legacy protocol to new protocol
log.debug("Resolution request for {} from {}", name, sender()) log.debug("Resolution request for {} from {}", name, sender())
warnAboutOldProtocolUse(name)
val adapted = DnsProtocol.Resolve(name) val adapted = DnsProtocol.Resolve(name)
val reply = (resolver ? adapted).mapTo[DnsProtocol.Resolved] val reply = (resolver ? adapted).mapTo[DnsProtocol.Resolved]
.map { asyncResolved .map { asyncResolved
@ -85,14 +84,5 @@ private[io] final class AsyncDnsManager(val ext: DnsExt) extends Actor
case CacheCleanup case CacheCleanup
cacheCleanup.foreach(_.cleanup()) cacheCleanup.foreach(_.cleanup())
} }
private def warnAboutOldProtocolUse(name: String): Unit = {
val warnAtMostTimes = 10
if (oldProtocolWarningLoggedTimes < warnAtMostTimes) {
oldProtocolWarningLoggedTimes += 1
log.warning("Received Dns.Resolve({}) message while Async DNS resolver active. Please use the new API [akka.io.dns.DnsProtocol] to issue resolve requests. " +
"(This warning will be logged at most {} times)", name, warnAtMostTimes)
}
}
} }