[tor-commits] [pytorctl/master] use Elixir model delete method

mikeperry at torproject.org mikeperry at torproject.org
Thu Sep 1 01:15:57 UTC 2011


commit db835ef1f6a252d9923be766f1d7dc813ea9a4eb
Author: aagbsn <aagbsn at extc.org>
Date:   Wed Aug 31 16:09:00 2011 -0700

    use Elixir model delete method
    
    try to use the same session for deletes and queries where possible,
    this may be the cause of an ObjectNotFound exception that occurs
    right after _update_db(), despite the Router object being in the
    consensus and also in the db.
---
 SQLSupport.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/SQLSupport.py b/SQLSupport.py
index 718bf35..5933707 100644
--- a/SQLSupport.py
+++ b/SQLSupport.py
@@ -1023,7 +1023,7 @@ class StreamListener(CircuitListener):
       (s.strm_id not in self.parent_handler.streams or \
            self.parent_handler.streams[s.strm_id].ignored):
       if strm:
-        tc_session.delete(strm)
+        strm.delete()
         tc_session.commit()
       return # Ignore streams that aren't ours
 
@@ -1038,7 +1038,7 @@ class StreamListener(CircuitListener):
       strm.circuit = Circuit.query.filter_by(circ_id=s.circ_id).first()
       if not strm.circuit:
         plog("NOTICE", "Ignoring prior stream "+str(strm.strm_id)+" with old circuit "+str(s.circ_id))
-        tc_session.delete(strm)
+        strm.delete()
         tc_session.commit()
         return
     else:





More information about the tor-commits mailing list