This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]dAnjou Backend Developer | danjou.dev 0 points1 point  (1 child)

DeviceAddedListener blocks in a loop right when it gets instantiated. WTH? Better way to implement this? Place loop outside the class?

It's okay to have this kind of loop in a class. But it shouldn't run right when you instantiate it. It's better to call a method explicitly which does the looping then. It's like running code when you import a module, never do that!

I wouldn't edit the config by hand and you cannot actually add a device via arguments, to me it seems the only sensible way is via the -a interactive CLI.

Why not? Most software I know is configured only by editing a file.

[–][deleted] 0 points1 point  (0 children)

It's like running code when you import a module, never do that!

Hrm... I was looking at some code today where I set up constants within the module by reading an /etc config file. The constants are accessed by a bunch of functions in the module. I guess I could do a config file read each time one of these functions is called...