##// END OF EJS Templates
prevent few remaining db requests from crashing Hub...
MinRK -
Show More
@@ -546,7 +546,7 b' class Hub(SessionFactory):'
546 return
546 return
547 queue_id, client_id = idents[:2]
547 queue_id, client_id = idents[:2]
548 try:
548 try:
549 msg = self.session.unpack_message(msg, content=False)
549 msg = self.session.unpack_message(msg)
550 except Exception:
550 except Exception:
551 self.log.error("queue::client %r sent invalid message to %r: %r"%(client_id, queue_id, msg), exc_info=True)
551 self.log.error("queue::client %r sent invalid message to %r: %r"%(client_id, queue_id, msg), exc_info=True)
552 return
552 return
@@ -571,9 +571,16 b' class Hub(SessionFactory):'
571 self.log.warn("conflicting initial state for record: %r:%r <%r> %r"%(msg_id, rvalue, key, evalue))
571 self.log.warn("conflicting initial state for record: %r:%r <%r> %r"%(msg_id, rvalue, key, evalue))
572 elif evalue and not rvalue:
572 elif evalue and not rvalue:
573 record[key] = evalue
573 record[key] = evalue
574 self.db.update_record(msg_id, record)
574 try:
575 self.db.update_record(msg_id, record)
576 except Exception:
577 self.log.error("DB Error updating record %r"%msg_id, exc_info=True)
575 except KeyError:
578 except KeyError:
576 self.db.add_record(msg_id, record)
579 try:
580 self.db.add_record(msg_id, record)
581 except Exception:
582 self.log.error("DB Error adding record %r"%msg_id, exc_info=True)
583
577
584
578 self.pending.add(msg_id)
585 self.pending.add(msg_id)
579 self.queues[eid].append(msg_id)
586 self.queues[eid].append(msg_id)
@@ -585,7 +592,7 b' class Hub(SessionFactory):'
585
592
586 client_id, queue_id = idents[:2]
593 client_id, queue_id = idents[:2]
587 try:
594 try:
588 msg = self.session.unpack_message(msg, content=False)
595 msg = self.session.unpack_message(msg)
589 except Exception:
596 except Exception:
590 self.log.error("queue::engine %r sent invalid message to %r: %r"%(
597 self.log.error("queue::engine %r sent invalid message to %r: %r"%(
591 queue_id,client_id, msg), exc_info=True)
598 queue_id,client_id, msg), exc_info=True)
@@ -635,7 +642,7 b' class Hub(SessionFactory):'
635 client_id = idents[0]
642 client_id = idents[0]
636
643
637 try:
644 try:
638 msg = self.session.unpack_message(msg, content=False)
645 msg = self.session.unpack_message(msg)
639 except Exception:
646 except Exception:
640 self.log.error("task::client %r sent invalid task message: %r"%(
647 self.log.error("task::client %r sent invalid task message: %r"%(
641 client_id, msg), exc_info=True)
648 client_id, msg), exc_info=True)
@@ -669,9 +676,15 b' class Hub(SessionFactory):'
669 self.log.warn("conflicting initial state for record: %r:%r <%r> %r"%(msg_id, rvalue, key, evalue))
676 self.log.warn("conflicting initial state for record: %r:%r <%r> %r"%(msg_id, rvalue, key, evalue))
670 elif evalue and not rvalue:
677 elif evalue and not rvalue:
671 record[key] = evalue
678 record[key] = evalue
672 self.db.update_record(msg_id, record)
679 try:
680 self.db.update_record(msg_id, record)
681 except Exception:
682 self.log.error("DB Error updating record %r"%msg_id, exc_info=True)
673 except KeyError:
683 except KeyError:
674 self.db.add_record(msg_id, record)
684 try:
685 self.db.add_record(msg_id, record)
686 except Exception:
687 self.log.error("DB Error adding record %r"%msg_id, exc_info=True)
675 except Exception:
688 except Exception:
676 self.log.error("DB Error saving task request %r"%msg_id, exc_info=True)
689 self.log.error("DB Error saving task request %r"%msg_id, exc_info=True)
677
690
@@ -679,7 +692,7 b' class Hub(SessionFactory):'
679 """save the result of a completed task."""
692 """save the result of a completed task."""
680 client_id = idents[0]
693 client_id = idents[0]
681 try:
694 try:
682 msg = self.session.unpack_message(msg, content=False)
695 msg = self.session.unpack_message(msg)
683 except Exception:
696 except Exception:
684 self.log.error("task::invalid task result message send to %r: %r"%(
697 self.log.error("task::invalid task result message send to %r: %r"%(
685 client_id, msg), exc_info=True)
698 client_id, msg), exc_info=True)
General Comments 0
You need to be logged in to leave comments. Login now