This commit is contained in:
@@ -96,7 +96,7 @@ namespace AyaNova.Biz
|
||||
_lastMMSnapshot = now;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////
|
||||
@@ -157,8 +157,25 @@ namespace AyaNova.Biz
|
||||
var UtilityFilesAvailableSpace = FileUtil.UtilityFilesDriveAvailableSpace();
|
||||
var AttachmentFilesAvailableSpace = FileUtil.AttachmentFilesDriveAvailableSpace();
|
||||
|
||||
|
||||
|
||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||
{
|
||||
//DB total size
|
||||
long DBTotalSize = 0;
|
||||
using (var command = ct.Database.GetDbConnection().CreateCommand())
|
||||
{
|
||||
command.CommandText = "select pg_database_size(current_database());";
|
||||
ct.Database.OpenConnection();
|
||||
using (var dr = command.ExecuteReader())
|
||||
{
|
||||
if (dr.HasRows)
|
||||
{
|
||||
DBTotalSize = dr.Read() ? dr.GetInt64(0) : 0;
|
||||
}
|
||||
ct.Database.CloseConnection();
|
||||
}
|
||||
}
|
||||
//write to db
|
||||
MetricDD dd = new MetricDD()
|
||||
{
|
||||
@@ -167,7 +184,8 @@ namespace AyaNova.Biz
|
||||
AttachmentFilesAvailableSpace = AttachmentFilesAvailableSpace,
|
||||
UtilityFileSize = UtilFilesInfo.SizeWithChildren,
|
||||
UtilityFileCount = UtilFilesInfo.FileCountWithChildren,
|
||||
UtilityFilesAvailableSpace = UtilityFilesAvailableSpace
|
||||
UtilityFilesAvailableSpace = UtilityFilesAvailableSpace,
|
||||
DBTotalSize = DBTotalSize
|
||||
};
|
||||
ct.MetricDD.Add(dd);
|
||||
ct.SaveChanges();
|
||||
|
||||
Reference in New Issue
Block a user