Skip to content

Commit

Permalink
Use bind instead of singleton.
Browse files Browse the repository at this point in the history
In some cases, it is possible for metadata failures to occur because the shared singleton is the wrong thing to use. Each disk requires it's own config. If the "storage ID" is different and you create two disk instances, you can end up in a situation where shared singleton now points to the wrong metadata storage ID and stuff begins to fail...
  • Loading branch information
nvahalik committed Mar 7, 2023
1 parent 40a72c3 commit 99b2703
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/FilerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function boot()

public function register()
{
$this->app->singleton(MetadataRepository::class, function ($app, $config) {
$this->app->bind(MetadataRepository::class, function ($app, $config) {
switch ($app['config']['filer']['metadata']) {
case 'json':
return new Json($app['config']['filer']['json']['storage_path']);
Expand Down

0 comments on commit 99b2703

Please sign in to comment.