Group(group_name).send({ 'text': json.dumps({ 'match_status': "balancing teams", }),})
gevent.hub.LoopExit: ('This operation would block forever', <Hub at 0x7fc465aabd58 epoll pending=0 ref=0 fileno=27>)
@client.on('logged_on') def start_dota(): Group(group_name).send({
'text': json.dumps({
'bot': getSteamProfile(str(client.steam_id)), }),
})
dota.launch() dota.wait_event('lobby_removed')
p = Thread(target=start_bot, args=(kwargs['instance'].match_id, group1, group2,group_name, rad_reward, dire_reward, team1, team2, ))p.start()
start_bot(kwargs['instance'].match_id, group1, group2,group_name, rad_reward, dire_reward, team1, team2)
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f6c574c4-3449-4d95-be78-2db3451fcc3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
@receiver(post_save, sender=chat_session)def on_create_users_online(sender, created, **kwargs):
....
some magic and conditions
....
start_bot(kwargs['instance'].match_id, group1, group2,group_name, rad_reward, dire_reward, team1, team2)
and in steam.py file:
def start_bot(match, group1, group2, group_name, rad_reward, dire_reward, team1, team2):
client = SteamClient() client.set_credential_location("steam_credentials") dota = Dota2Client(client)
.... some code ....
@client.on('logged_on') def start_dota(): Group(group_name).send({
'text': json.dumps({
'bot': getSteamProfile(str(client.steam_id)), }),
})
dota.launch() dota.wait_event('lobby_removed') ..... a lot of events and code .....
client.connect() client.run_forever()
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
I call it in signal function after enough of user rows is in DB:
@receiver(post_save, sender=chat_session)
def on_create_users_online(sender, created, **kwargs):
....
some magic conditions
....
start_bot(kwargs['instance'].match_id, group1, group2,group_name, rad_reward, dire_reward, team1, team2)
I will try to describe entire process...so:User connects to websocket and after they are added to group. All users in group are saved to DB chat_session table.Once enough users is connected to same group then steam client is started in signal function above.Then mess I explained above starts to happen.Even tho steam client is working properly, channels are not and daphne crashes because of block forever errors and backpressure.
Dne úterý 7. března 2017 19:08:39 UTC+1 Andrew Godwin napsal(a):
Where are you running this steam client from? Presumably not a webserver process, as that doesn't have a main thread. Could you explain a bit more about the architecture and what channel layers you have configured?Andrew
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f6c574c4-3449-4d95-be78-2db3451fcc3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fac65b2c-f7ad-4431-81c2-d86f8dc890f3%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ea8ac4d0-925f-4ad7-8610-c067ba438468%40googlegroups.com.