当前位置: 首页>>代码示例>>Python>>正文


Python PySQLPool.cleanupPool方法代码示例

本文整理汇总了Python中PySQLPool.cleanupPool方法的典型用法代码示例。如果您正苦于以下问题:Python PySQLPool.cleanupPool方法的具体用法?Python PySQLPool.cleanupPool怎么用?Python PySQLPool.cleanupPool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PySQLPool的用法示例。


在下文中一共展示了PySQLPool.cleanupPool方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: import PySQLPool [as 别名]
# 或者: from PySQLPool import cleanupPool [as 别名]
	def run(self):

		with Connection.Connection(self.socket, self.name, self.debug) as conn:
			while conn.get_message():

				answer = self.default_answer

				if conn["sender"] != "" and conn["recipient"] != "":
					if self.debug:
						logging.debug("Mail from {0} to {1} with SASL: {2}".format(conn["sender"], conn["recipient"], conn["sasl_username"]))
					for flt in self.flts:
						with self._mutex:
							try:
								flt_answer = flt.check(conn)
							except:
								logging.error("Error in checking policy {0}. Traceback: \n{1}\n".format(flt, traceback.format_exc()))
						if flt_answer:
							break

					if flt_answer:
						answer = flt_answer

					if self.debug:
						logging.debug("Answer for mail {0} to {1} was: {2}".format(conn["sender"], conn["recipient"], answer))

				if conn["request"] == "smtpd_access_policy":
					conn.answer(answer)
				try:
					PySQLPool.cleanupPool()
				except:
					logging.warn('Error in cleaning SQL pool. Traceback: \n{0}\n'.format(traceback.format_exc()))
		if self.debug:
			stop_time = time.time()
			logging.debug("Process named {0} started {1}, stopped {2}. Working {3} seconds.".format(self.name, time.strftime("%d.%m.%y - %H:%M:%S", time.localtime(self.start_time)), time.strftime("%d.%m.%y - %H:%M:%S", time.localtime(stop_time)), (stop_time - self.start_time)))
开发者ID:flant,项目名称:LMPD,代码行数:36,代码来源:Worker.py


注:本文中的PySQLPool.cleanupPool方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。