生成协程id
(coro=None)
| 285 | |
| 286 | @staticmethod |
| 287 | def gen_coro_id(coro=None): |
| 288 | """生成协程id""" |
| 289 | name = 'coro' |
| 290 | if hasattr(coro, '__name__'): |
| 291 | name = coro.__name__ |
| 292 | |
| 293 | return '%s-%s' % (name, random_str(10)) |
| 294 | |
| 295 | def __init__(self, coro, session: CoroutineBasedSession, on_coro_stop=None): |
| 296 | """ |