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

Fix reconnection in SQL Mixin #2201

Merged
merged 3 commits into from
Jul 15, 2022
Merged

Conversation

wagner-intevation
Copy link
Contributor

Fixes #2200:

  • bug: sql mixin: add missing import of exception
  • sql mixin: properly separate parameters from internal variables
    parameters show not be changed during runtime, this prevents reloading
    the bot and other re-initializations (self.engine was made a class
    instance)
  • bug: sql mixin: reconnect on connection issues
    separate the sql mixin initialization from the __init__ to be able to
    call it from inside the bot for re-connecting.
    calling self.__init__ would require at least the bot-id
    calling self._connect would require preparing all the arguments

parameters show not be changed during runtime, this prevents reloading
the bot and other re-initializations (self.engine was made a class
instance)
separate the sql mixin initialization from the __init__ to be able to
call it from inside the bot for re-connecting.
calling self.__init__ would require at least the bot-id
calling self._connect would require preparing all the arguments

fixes certtools#2200
@codecov-commenter
Copy link

codecov-commenter commented Jul 1, 2022

Codecov Report

Merging #2201 (5249d0e) into develop (79cae29) will increase coverage by 0.00%.
The diff coverage is 50.00%.

@@           Coverage Diff            @@
##           develop    #2201   +/-   ##
========================================
  Coverage    76.34%   76.34%           
========================================
  Files          441      441           
  Lines        23654    23657    +3     
  Branches      3739     3739           
========================================
+ Hits         18059    18062    +3     
  Misses        4858     4858           
  Partials       737      737           
Impacted Files Coverage Δ
intelmq/lib/mixins/sql.py 56.92% <50.00%> (+2.08%) ⬆️

@sebix sebix self-assigned this Jul 15, 2022
@sebix sebix added bug Indicates an unexpected problem or unintended behavior component: bots labels Jul 15, 2022
@sebix sebix added this to the 3.1.0 milestone Jul 15, 2022
@sebix sebix merged commit ee28f6e into certtools:develop Jul 15, 2022
@wagner-intevation wagner-intevation deleted the fix-220 branch July 15, 2022 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior component: bots
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Postgres Output (SQL Mixin): not re-connecting on connection issues
4 participants