Skip to content

Commit

Permalink
fix cache bug
Browse files Browse the repository at this point in the history
  • Loading branch information
fritzprix committed Jul 19, 2019
1 parent f6d33f6 commit fed949f
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 53 deletions.
118 changes: 66 additions & 52 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/main/java/com/doodream/robustdns/RobustDnsResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ private RobustDnsResolver() {
public Single<InetAddress> resolve(String name) {
if(cache.containsKey(name)) {
final DnsRecord record = cache.get(name);
if(record.expireAt > System.currentTimeMillis()) {
if(record.expireAt < System.currentTimeMillis()) {
System.out.println("cache miss");
cache.remove(name);
if(updateOnExpire) {
resolve(name).subscribe();
Expand Down

0 comments on commit fed949f

Please sign in to comment.