Skip to content

Commit c905b86

Browse files
Instances where a commit can happen without a close (#363)
I've found a couple of instances where the database can be committed to without then being closed: - Tomography preprocessing flushes - Particle picking registration if an ispyb picker id is not found The second one of these would explain why we see spikes in database connections shortly after collections start. Once the picker id is found all the connections end up closed. Closes #362
1 parent a125e4d commit c905b86

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/murfey/server/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -809,15 +809,15 @@ def _register_picked_particles_use_boxsize(message: dict, _db=murfey_db):
809809
defocus_v=params_to_forward["ctf_values"]["DefocusV"],
810810
defocus_angle=params_to_forward["ctf_values"]["DefocusAngle"],
811811
)
812-
murfey_db.add(ctf_params)
813-
murfey_db.commit()
814-
murfey_db.close()
812+
_db.add(ctf_params)
813+
_db.commit()
814+
_db.close()
815815

816816
# Set particle diameter as zero and send box sizes
817-
relion_params = murfey_db.exec(
817+
relion_params = _db.exec(
818818
select(db.SPARelionParameters).where(db.SPARelionParameters.pj_id == pj_id)
819819
).one()
820-
feedback_params = murfey_db.exec(
820+
feedback_params = _db.exec(
821821
select(db.SPAFeedbackParameters).where(db.SPAFeedbackParameters.pj_id == pj_id)
822822
).one()
823823

@@ -874,6 +874,7 @@ def _register_picked_particles_use_boxsize(message: dict, _db=murfey_db):
874874
}
875875
if _transport_object:
876876
_transport_object.send("processing_recipe", zocalo_message, new_connection=True)
877+
_db.close()
877878

878879

879880
def _release_2d_hold(message: dict, _db=murfey_db):
@@ -2127,6 +2128,7 @@ def _flush_tomography_preprocessing(message: dict):
21272128
)
21282129
murfey_db.delete(f)
21292130
murfey_db.commit()
2131+
murfey_db.close()
21302132

21312133

21322134
def _flush_grid_square_records(message: dict, _db=murfey_db, demo: bool = False):

0 commit comments

Comments
 (0)