Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PSGI: Consistent use of DBIx::Connector #434

Closed
4 tasks done
bschmalhofer opened this issue Sep 12, 2020 · 5 comments
Closed
4 tasks done

PSGI: Consistent use of DBIx::Connector #434

bschmalhofer opened this issue Sep 12, 2020 · 5 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@bschmalhofer
Copy link
Contributor

bschmalhofer commented Sep 12, 2020

In Kernel::System::DB::Connect there is currently both a reuse of $Self->{dbh} and reconnection with DBIx::Connector. While this works it is probably not best practice.

TODO:

  • Investigate what best practice actually is
  • Check whether rel-10_0 and rel-10_1 already diverge
  • Run the DB::Connect statements as Callbacks
  • implement
@bschmalhofer bschmalhofer added the enhancement New feature or request label Sep 12, 2020
@bschmalhofer bschmalhofer added this to the OTOBO 10.0.3 milestone Sep 12, 2020
@bschmalhofer bschmalhofer self-assigned this Sep 12, 2020
@bschmalhofer
Copy link
Contributor Author

bschmalhofer commented Sep 13, 2020

According to https://metacpan.org/pod/release/DWHEELER/DBIx-Connector-0.47/lib/DBIx/Connector.pm#dbh and http://perladvent.org/2011/2011-12-22.html it looks like simply using the method dbh of the connector object is best practice. The method dbhpings the database itself, this means that the pings in Kernel::System::DB can be skipped.

The downside is that this would increase the number or pings when running under PSGI.
The upside is that reliability should be improved.
No changes for command line, cron and Daemon processes as F#for non-web processes the old behavior can be used for now.

For avoiding too frequent pings one can use the fixup connection mode. See https://metacpan.org/pod/release/DWHEELER/DBIx-Connector-0.47/lib/DBIx/Connector.pm#Connection-Modes. But this is beyond the scope of this ticket.

@bschmalhofer
Copy link
Contributor Author

Also, in OTOBO 10.0.2 there is bug in the PSGI case. The attribure 'RaiseError => 0' was not passed to DBIx::Connector->new(). It is not clear whether this had noticable effects.

@bschmalhofer
Copy link
Contributor Author

There are some issues regarding the UnitTests in the non-PSGI. The cause is not obvious. So let's be more conservative and avoid any code changes for the non-PSGI case.

bschmalhofer added a commit that referenced this issue Sep 22, 2020
For PSGI we rely on DBIx::Connector
bschmalhofer added a commit that referenced this issue Sep 22, 2020
@svenoe
Copy link
Contributor

svenoe commented Sep 24, 2020

We should probably keep the non-PSGI case like this for OTOBO 10.0.

@svenoe svenoe modified the milestones: OTOBO 10.0.3, OTOBO 10.1 Sep 24, 2020
@bschmalhofer
Copy link
Contributor Author

No new problems surfaces. @svenoe did a code review. Closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants