Classify HTTP responses into buckets, treat 15 seconds as fresh, 1 minute as less fresh, etc. This ensures that differences in the order of seconds do not affect master choice.
| 36 | // less fresh, etc. This ensures that differences in the order of seconds do |
| 37 | // not affect master choice. |
| 38 | static int ClassifyAge(int AgeSeconds) |
| 39 | { |
| 40 | return 0 // |
| 41 | + (AgeSeconds >= 15) // 15 seconds |
| 42 | + (AgeSeconds >= 60) // 1 minute |
| 43 | + (AgeSeconds >= 300) // 5 minutes |
| 44 | + (AgeSeconds / 3600); // 1 hour |
| 45 | } |
| 46 | |
| 47 | class CChooseMaster |
| 48 | { |