When starting up, we try to retrieve the purge interval for the bucket (either set at a bucket or cluster level), and if we can't get this due to access we assume a default of 30 days:
The problem is we define the constant in days (which matches how you define the value in Couchbase Server), however everywhere we use it we treat it as hours:
This is because when we get the value from Couchbase Server (if we're successful) we immediately munge it to be in hours, and then use this value in everything "Sync Gateway related":
This should be as simple as adding a * 24 to the constant definition, but I wonder if it makes sense to pass around a time.Duration for all of this instead?
Marking as critical, as in cases where this happens (which, reasonably will be the default - interval set at 3 days at the cluster level, and no user admin access to see it) we'll see documents prematurely purged from indexes based on this.