You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -50,7 +49,6 @@ public function __construct(array $stores, StrategyInterface $strategy)
50
49
51
50
$this->stores = $stores;
52
51
$this->strategy = $strategy;
53
-
$this->logger = newNullLogger();
54
52
}
55
53
56
54
publicfunctionsave(Key$key): void
@@ -64,7 +62,7 @@ public function save(Key $key): void
64
62
$store->save($key);
65
63
++$successCount;
66
64
} catch (\Exception$e) {
67
-
$this->logger->debug('One store failed to save the "{resource}" lock.', ['resource' => $key, 'store' => $store, 'exception' => $e]);
65
+
$this->logger?->debug('One store failed to save the "{resource}" lock.', ['resource' => $key, 'store' => $store, 'exception' => $e]);
68
66
++$failureCount;
69
67
}
70
68
@@ -79,7 +77,7 @@ public function save(Key $key): void
79
77
return;
80
78
}
81
79
82
-
$this->logger->info('Failed to store the "{resource}" lock. Quorum has not been met.', ['resource' => $key, 'success' => $successCount, 'failure' => $failureCount]);
80
+
$this->logger?->info('Failed to store the "{resource}" lock. Quorum has not been met.', ['resource' => $key, 'success' => $successCount, 'failure' => $failureCount]);
83
81
84
82
// clean up potential locks
85
83
$this->delete($key);
@@ -102,7 +100,7 @@ public function saveRead(Key $key): void
102
100
}
103
101
++$successCount;
104
102
} catch (\Exception$e) {
105
-
$this->logger->debug('One store failed to save the "{resource}" lock.', ['resource' => $key, 'store' => $store, 'exception' => $e]);
103
+
$this->logger?->debug('One store failed to save the "{resource}" lock.', ['resource' => $key, 'store' => $store, 'exception' => $e]);
106
104
++$failureCount;
107
105
}
108
106
@@ -117,7 +115,7 @@ public function saveRead(Key $key): void
117
115
return;
118
116
}
119
117
120
-
$this->logger->info('Failed to store the "{resource}" lock. Quorum has not been met.', ['resource' => $key, 'success' => $successCount, 'failure' => $failureCount]);
118
+
$this->logger?->info('Failed to store the "{resource}" lock. Quorum has not been met.', ['resource' => $key, 'success' => $successCount, 'failure' => $failureCount]);
121
119
122
120
// clean up potential locks
123
121
$this->delete($key);
@@ -135,15 +133,15 @@ public function putOffExpiration(Key $key, float $ttl): void
135
133
foreach ($this->storesas$store) {
136
134
try {
137
135
if (0.0 >= $adjustedTtl = $expireAt - microtime(true)) {
138
-
$this->logger->debug('Stores took to long to put off the expiration of the "{resource}" lock.', ['resource' => $key, 'store' => $store, 'ttl' => $ttl]);
136
+
$this->logger?->debug('Stores took to long to put off the expiration of the "{resource}" lock.', ['resource' => $key, 'store' => $store, 'ttl' => $ttl]);
139
137
$key->reduceLifetime(0);
140
138
break;
141
139
}
142
140
143
141
$store->putOffExpiration($key, $adjustedTtl);
144
142
++$successCount;
145
143
} catch (\Exception$e) {
146
-
$this->logger->debug('One store failed to put off the expiration of the "{resource}" lock.', ['resource' => $key, 'store' => $store, 'exception' => $e]);
144
+
$this->logger?->debug('One store failed to put off the expiration of the "{resource}" lock.', ['resource' => $key, 'store' => $store, 'exception' => $e]);
147
145
++$failureCount;
148
146
}
149
147
@@ -158,7 +156,7 @@ public function putOffExpiration(Key $key, float $ttl): void
158
156
return;
159
157
}
160
158
161
-
$this->logger->notice('Failed to define the expiration for the "{resource}" lock. Quorum has not been met.', ['resource' => $key, 'success' => $successCount, 'failure' => $failureCount]);
159
+
$this->logger?->notice('Failed to define the expiration for the "{resource}" lock. Quorum has not been met.', ['resource' => $key, 'success' => $successCount, 'failure' => $failureCount]);
162
160
163
161
// clean up potential locks
164
162
$this->delete($key);
@@ -172,7 +170,7 @@ public function delete(Key $key): void
172
170
try {
173
171
$store->delete($key);
174
172
} catch (\Exception$e) {
175
-
$this->logger->notice('One store failed to delete the "{resource}" lock.', ['resource' => $key, 'store' => $store, 'exception' => $e]);
173
+
$this->logger?->notice('One store failed to delete the "{resource}" lock.', ['resource' => $key, 'store' => $store, 'exception' => $e]);
176
174
}
177
175
}
178
176
}
@@ -191,7 +189,7 @@ public function exists(Key $key): bool
191
189
++$failureCount;
192
190
}
193
191
} catch (\Exception$e) {
194
-
$this->logger->debug('One store failed to check the "{resource}" lock.', ['resource' => $key, 'store' => $store, 'exception' => $e]);
192
+
$this->logger?->debug('One store failed to check the "{resource}" lock.', ['resource' => $key, 'store' => $store, 'exception' => $e]);
0 commit comments