joshuaskelly / twitch-observer

Turn Twitch chatter into Python events
MIT License
26 stars 6 forks source link

High CPU usage as soon as observer starts #75

Open Unixsystem13 opened 5 years ago

Unixsystem13 commented 5 years ago
import time
from twitchobserver import Observer

observer = Observer('name', 'oauth:1234etc')
observer.start()

while True:
    time.sleep(1)
    print("sleep")

This script is giving me 10-15% CPU on a high end, modern CPU. If I remove the line oberver.start(), it uses <0.1%. It's enough that if I try to run the script while streaming a demanding game, the game's framerate drops into unplayability. Is this somehow expected behavior or am I missing something obvious?

PythooonUser commented 5 years ago

Calling observer.start() is needed when you want to use the bot, only then it starts receiving messages from the chat.

Have you tried to run any of the examples either in the readme or in the cookbook? The Echo Bot is a good example to start with.

Is this giving you a high CPU usage as well?