Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

django连接mqtt 会连接两次 #56

Open
liyang0501rs opened this issue Oct 20, 2022 · 2 comments
Open

django连接mqtt 会连接两次 #56

liyang0501rs opened this issue Oct 20, 2022 · 2 comments

Comments

@liyang0501rs
Copy link

如果不设置client_id,会自动生成两个不通的id进行操作,如果设置了client id,感觉像是两个线程互相把对方挤掉线重连,如何避免这问题?

@zibuyu1995
Copy link
Member

您能提供一下连接源码吗?

@zhaozusong
Copy link

这个是因为在启动项目的时候,运行项目加载一次项目代码,django自动重载加载了一次,导致mqtt.client.loop_start()执行了两次,可以在启动项目时添加--noreload来关闭自动重载,这样启动项目就只加载一次,但,如果你修改了代码后项目就不会自动重启,需要手动重启

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants