async def METHOD_NAME(app, max_latency=0.01) -> None:
    # Leader node sends incrementing numbers to a topic
    partitions_sent_counter.clear()
    while not app.should_stop:
        if app.rebalancing:
            partitions_sent_counter.clear()
            await app.sleep(5)
        if app.is_leader():
            for partition in range(app.conf.topic_partitions):
                if app.rebalancing:
                    break
                current_value = partitions_sent_counter.get(partition, 0)
                await process.send(value=current_value, partition=partition)
                partitions_sent_counter[partition] += 1
            await app.sleep(random.uniform(0, max_latency))
        else:
            await app.sleep(1)