debunce posthog events to every 5 minutes

This commit is contained in:
mungai-njoroge 2023-09-27 22:06:45 +03:00
parent d3682e4597
commit 263379abf3

View File

@ -20,10 +20,16 @@ from app.utils.threading import background
api = Blueprint("artist", __name__, url_prefix="/")
ARTIST_VISIT_COUNT = 0
@background
def send_event():
Telemetry.send_artist_visited()
global ARTIST_VISIT_COUNT
ARTIST_VISIT_COUNT += 1
if ARTIST_VISIT_COUNT % 5 == 0:
Telemetry.send_artist_visited()
@api.route("/artist/<artisthash>", methods=["GET"])