private bool DeleteFile(string fullPath) { try { System.IO.File.Delete(fullPath); Logger.Debug("V20.FillCacheProvider file deleted: " + fullPath); return(true); } catch (Exception) { System.Threading.Thread.Sleep(100); try { System.IO.File.Delete(fullPath); return(true); } catch (Exception) { System.Threading.Thread.Sleep(200); try { System.IO.File.Delete(fullPath); return(true); } catch (Exception) { Logger.Error("V20.FillCacheProvider file cannot be deleted: " + fullPath); return(false); } } } }
public void Remove(string key) { var res = client.Delete <Bag <T> >(fixKey(key)); if (res.IsValid == false) { ESTraceLogger.Error($"ElasticCacheProvider: remove record {key} error {res.ServerError?.ToString()}", res.OriginalException); } }
private void logger_Error(string msg, Exception ex = null) { try { if (!this.DontLogAnything) { WebLogger.Error(msg, ex); } } catch { } }
public void Remove(string key) { try { //lock (_lockconnections) //{ var res = client.DeleteObjectAsync(this.Bucket, fixKey(key)).Result; //client.RemoveObjectAsync(this.Bucket, fixKey(key)).Wait(); //} } catch (Exception e) { ESTraceLogger.Error($"AWS_S3CacheProvider: remove record {fixKey(key)} error {e.Message}", e); } }
private Version GetVersionOfDatabaseUsingExtendedProperty() { this._connection.SmartOpen(); using (SqlCommand cmd = this._connection.CreateCommand()) { cmd.CommandText = string.Format("select value from ::fn_listextendedproperty('{0}', DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT)", this._objectNameForVersionInfo); try { object result = cmd.ExecuteScalar(); return(new Version((string)result)); } catch (Exception e) { logger.Error("Could not find version info in database. Query {query}", e, cmd.CommandText); throw new DatabaseUpgradeException("Could not find version info in database."); } } }
protected virtual TResult GetDataFromContentFunction() { TResult data = default(TResult); if (this.contentInfo.Function == null) { Logger.Info("Starting GetDataFromContentFunction : No contentFunction for type " + typeof(TResult).ToString()); return(data); } try { Logger.Debug("Starting GetDataFromContentFunction for type " + typeof(TResult).ToString()); data = this.contentInfo.Function(this.contentInfo.Parameters); this.contentInfo.DataLoaded = DateTime.Now; Logger.Debug("Finished GetDataFromContentFunction for type " + typeof(TResult).ToString()); return(data); } catch (Exception e) { Logger.Error("Get Content from ContentFunction call error", e); return(data); } }