I don’t think the query is the right approach here. Here is the post that explains how polling should be implemented.