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

Add SQLAlchemy error handling to tasks and the irc backend #272

Merged
merged 3 commits into from
Jan 15, 2018

Conversation

jeremycline
Copy link
Member

No description provided.

Signed-off-by: Jeremy Cline <jeremy@jcline.org>
@jeremycline jeremycline force-pushed the handle-sql-errors branch 2 times, most recently from 190f2f5 to 4e34c4a Compare January 2, 2018 18:18
@codecov
Copy link

codecov bot commented Jan 2, 2018

Codecov Report

Merging #272 into develop will decrease coverage by 0.25%.
The diff coverage is 38.5%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #272      +/-   ##
===========================================
- Coverage    56.78%   56.53%   -0.26%     
===========================================
  Files           70       70              
  Lines         3862     3690     -172     
  Branches       528      474      -54     
===========================================
- Hits          2193     2086     -107     
+ Misses        1594     1536      -58     
+ Partials        75       68       -7
Impacted Files Coverage Δ
fmn/delivery/backends/irc.py 18.75% <1.16%> (-5.61%) ⬇️
fmn/tasks.py 78.78% <66.66%> (-2.81%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 06075e7...5213eb1. Read the comment docs.

Add SQLAlchemy error handling to the tasks.

fixes fedora-infra#268

Signed-off-by: Jeremy Cline <jeremy@jcline.org>
@@ -206,66 +216,71 @@ def subcmd_filters(self, nick, message):
log.info("CMD list filters: %r sent us %r" % (nick, message))

valid_paths = fmn.lib.load_rules(root="fmn.rules")
sess = fmn.lib.models.init(self.config.get('fmn.sqlalchemy.uri'))
pref = self.get_preference(sess, nick)
sess = fmn.lib.models.Session.remove()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be .Session()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, fmn.lib.models.Session is a scoped session.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. But at this moment you are trying to get a new session, correct? Not closing this one, right at the start of the call?

Copy link

@puiterwijk puiterwijk Jan 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifically: you're assigned the result to the Session.remove() call to something, but that function doesn't even return anything? https://github.com/zzzeek/sqlalchemy/blob/master/lib/sqlalchemy/orm/scoping.py#L76

Copy link

@puiterwijk puiterwijk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix sess = ..Session.remove().
Otherwise looks fine.

fixes fedora-infra#271

Signed-off-by: Jeremy Cline <jeremy@jcline.org>
@jeremycline jeremycline merged commit 1be4c79 into fedora-infra:develop Jan 15, 2018
@jeremycline jeremycline deleted the handle-sql-errors branch January 15, 2018 14:17
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.

2 participants