private void UpdateSkippedCheck() { lastCheck = DateTime.UtcNow; var totalSizeOnDisk = database.GetTotalSizeOnDisk(); if (totalSizeOnDisk <= softLimit) { WarningMessagesHolder.RemoveWarnings(database, WarningPrefixName); skipCheck = VetoResult.Allowed; recheckOnDelete = false; return; } recheckOnDelete = true; string msg; if (totalSizeOnDisk > hardLimit) // beyond the grace margin { msg = string.Format("Database size is {0:#,#} KB, which is over the allowed quota of {1:#,#} KB. No more documents are allowed in.", totalSizeOnDisk / 1024, hardLimit / 1024); WarningMessagesHolder.AddWarning(database, WarningPrefixName, msg); skipCheck = VetoResult.Deny(msg); } else // still before the hard limit, warn, but allow { msg = string.Format("Database size is {0:#,#} KB, which is close to the allowed quota of {1:#,#} KB", totalSizeOnDisk / 1024, softLimit / 1024); WarningMessagesHolder.AddWarning(database, WarningPrefixName, msg); skipCheck = VetoResult.Allowed; } }
private void UpdateSkippedCheck() { lastCheck = DateTime.Now; var totalSizeOnDisk = database.GetTotalSizeOnDisk(); if (totalSizeOnDisk <= softLimit) { WarningMessagesHolder.RemoveWarnings(database, "Size Qouta"); skipCheck = VetoResult.Allowed; recheckOnDelete = false; return; } recheckOnDelete = true; string msg; if (totalSizeOnDisk > softLimit + margin) // beyond the grace margin { msg = string.Format("Database size is {0:#,#}kb, which is over the {1:#,#} allows qouta", totalSizeOnDisk / 1024, softLimit / 1024); WarningMessagesHolder.AddWarning(database, "Size Qouta", msg); skipCheck = VetoResult.Deny(msg); } else // still in the grace period, warn, but allow { msg = string.Format("Database size is {0:#,#}kb, which is over the {1:#,#} allows qouta", totalSizeOnDisk / 1024, softLimit / 1024); WarningMessagesHolder.AddWarning(database, "Size Qouta", msg); skipCheck = VetoResult.Allowed; } }
private void UpdateSkippedCheck() { lastCheck = DateTime.UtcNow; var totalSizeOnDisk = database.GetTotalSizeOnDisk(); if (totalSizeOnDisk <= softLimit) { database.Delete("Raven/Quotas/Size", null, null); skipCheck = VetoResult.Allowed; recheckOnDelete = false; return; } recheckOnDelete = true; string msg; if (totalSizeOnDisk > hardLimit) // beyond the grace margin { msg = string.Format("Database size is {0:#,#} KB, which is over the allowed quota of {1:#,#} KB. No more documents are allowed in.", totalSizeOnDisk / 1024, hardLimit / 1024); database.Put("Raven/Quotas/Size", null, new RavenJObject { {"Message", msg} }, new RavenJObject(), null); skipCheck = VetoResult.Deny(msg); } else // still before the hard limit, warn, but allow { msg = string.Format("Database size is {0:#,#} KB, which is close to the allowed quota of {1:#,#} KB", totalSizeOnDisk / 1024, softLimit / 1024); database.Put("Raven/Quotas/Size", null, new RavenJObject { {"Message", msg} }, new RavenJObject(), null); skipCheck = VetoResult.Allowed; } }
private void UpdateSkippedCheck() { lastCheck = SystemTime.UtcNow; var countOfDocuments = database.Statistics.CountOfDocuments; if (countOfDocuments <= softLimit) { database.Delete("Raven/Quotas/Documents", null, null); skipCheck = VetoResult.Allowed; recheckOnDelete = false; return; } recheckOnDelete = true; string msg; if (countOfDocuments > hardLimit) // beyond the grace margin { msg = string.Format("Database doc count is {0:#,#}, which is over the allowed quota of {1:#,#}. No more documents are allowed in.", countOfDocuments, hardLimit); database.Put("Raven/Quotas/Documents", null, new RavenJObject { {"Message", msg} }, new RavenJObject(), null); skipCheck = VetoResult.Deny(msg); } else // still before the hard limit, warn, but allow { msg = string.Format("Database doc count is {0:#,#}, which is close to the allowed quota of {1:#,#}.", countOfDocuments, softLimit); database.Put("Raven/Quotas/Documents", null, new RavenJObject { {"Message", msg} }, new RavenJObject(), null); skipCheck = VetoResult.Allowed; } }