Skip to content

Commit 21e7cb3

Browse files
lutterFilippo Neysofu Costa
authored andcommitted
graph, store: Remove GRAPH_STORE_CONNECTION_TRY_ALWAYS
This flag was only meant as a safety feature in case checking for database availability causes issues. We've run with its default value for a very long time now, and can remove it.
1 parent 769d587 commit 21e7cb3

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

graph/src/env/store.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,6 @@ pub struct EnvVarsStore {
5050
/// Set by the flag `GRAPH_DISABLE_SUBSCRIPTION_NOTIFICATIONS`. Not set
5151
/// by default.
5252
pub disable_subscription_notifications: bool,
53-
/// A fallback in case the logic to remember database availability goes
54-
/// wrong; when this is set, we always try to get a connection and never
55-
/// use the availability state we remembered.
56-
///
57-
/// Set by the flag `GRAPH_STORE_CONNECTION_TRY_ALWAYS`. Disabled by
58-
/// default.
59-
pub connection_try_always: bool,
6053
/// Set by the environment variable `GRAPH_REMOVE_UNUSED_INTERVAL`
6154
/// (expressed in minutes). The default value is 360 minutes.
6255
pub remove_unused_interval: chrono::Duration,
@@ -115,7 +108,6 @@ impl From<InnerStore> for EnvVarsStore {
115108
typed_children_set_size: x.typed_children_set_size,
116109
order_by_block_range: x.order_by_block_range.0,
117110
disable_subscription_notifications: x.disable_subscription_notifications.0,
118-
connection_try_always: x.connection_try_always.0,
119111
remove_unused_interval: chrono::Duration::minutes(
120112
x.remove_unused_interval_in_minutes as i64,
121113
),
@@ -149,8 +141,6 @@ pub struct InnerStore {
149141
order_by_block_range: EnvVarBoolean,
150142
#[envconfig(from = "GRAPH_DISABLE_SUBSCRIPTION_NOTIFICATIONS", default = "false")]
151143
disable_subscription_notifications: EnvVarBoolean,
152-
#[envconfig(from = "GRAPH_STORE_CONNECTION_TRY_ALWAYS", default = "false")]
153-
connection_try_always: EnvVarBoolean,
154144
#[envconfig(from = "GRAPH_REMOVE_UNUSED_INTERVAL", default = "360")]
155145
remove_unused_interval_in_minutes: u64,
156146
#[envconfig(from = "GRAPH_STORE_RECENT_BLOCKS_CACHE_CAPACITY", default = "10")]

store/postgres/src/connection_pool.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,12 +360,11 @@ impl ConnectionPool {
360360
/// `StoreError::DatabaseUnavailable`
361361
fn get_ready(&self) -> Result<Arc<PoolInner>, StoreError> {
362362
let mut guard = self.inner.lock(&self.logger);
363-
if !self.state_tracker.is_available() && !ENV_VARS.store.connection_try_always {
363+
if !self.state_tracker.is_available() {
364364
// We know that trying to use this pool is pointless since the
365365
// database is not available, and will only lead to other
366366
// operations having to wait until the connection timeout is
367-
// reached. `TRY_ALWAYS` allows users to force us to try
368-
// regardless.
367+
// reached.
369368
return Err(StoreError::DatabaseUnavailable);
370369
}
371370

0 commit comments

Comments
 (0)