(callback)
| 257 | |
| 258 | @wraps(callback) |
| 259 | def run(callback): |
| 260 | try: |
| 261 | callback(event['data']) |
| 262 | except Exception as e: |
| 263 | # 子类可能会重写 get_current_session ,所以不要用 ThreadBasedSession.get_current_session 来调用 |
| 264 | if not isinstance(e, SessionException): |
| 265 | self.on_task_exception() |
| 266 | |
| 267 | # todo: good to have -> clean up from `register_thread()` |
| 268 | |
| 269 | if mutex: |
| 270 | run(callback) |
no test coverage detected