using scheduler instead of while True for reading data.