Skip to content

Conversation

@qdequippe
Copy link
Contributor

@qdequippe qdequippe commented Apr 17, 2025

When using flysystem in worker (never stopped) the connection stay active. Add an option to disconnect on object destruction.

@qdequippe qdequippe marked this pull request as draft April 17, 2025 15:51
@qdequippe qdequippe changed the title Add option to disconnect on desctruct Add option to disconnect on destruct Apr 17, 2025
@qdequippe qdequippe marked this pull request as ready for review April 24, 2025 09:11
@frankdejonge frankdejonge merged commit 77ab452 into thephpleague:3.x Jun 25, 2025
@qdequippe
Copy link
Contributor Author

thanks @frankdejonge

@qdequippe qdequippe deleted the disconnect-on-destruct branch June 25, 2025 13:05
@bendavies
Copy link

is there a way to configure this option when using the bundle?

@bendavies
Copy link

i don't think so, i'll add

@bendavies
Copy link

for now, a compiler pass with something like this should do it:

    public function process(ContainerBuilder $container): void
    {
        $jencapStorageDefinition = $container->getDefinition('flysystem.adapter.foo.storage');

        if ($jencapStorageDefinition->getClass() === SftpAdapter::class) {
            $jencapStorageDefinition->setArgument('$disconnectOnDestruct', true);
        }
    }

@maxhelias
Copy link
Contributor

You can submit a PR on the bundle to support this option in the adapter here : https://github.com/thephpleague/flysystem-bundle/blob/3.x/src/Adapter/Builder/SftpAdapterDefinitionBuilder.php I'll be happy to merge it 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants