长轮询问题

I have strange issue, I'm doing long polling to check if something new appeared in MySQL table, everything works fine, I'm getting messages as soon as they appear in table. but problem is when I'm trying to reload my page (F5) I have to wait until server side function is completed and then my page refreshes.

For example my long polling start and I refresh page in first second of execution, I have to wait 29 seconds for page to refresh.

Does anyone knows whats going on?

Thanks in advance!

here is code

php

public function longPolling() {
    if (isset($_POST['timestamp'])) {
        $timestamp = $_POST['timestamp'];
    }
    $end = time() + 20;
    while (time() <= $end) {
        $data = $this->db->select("SELECT id, status, error, start, end, ackby FROM event WHERE start > '$timestamp'", 0);
        if ($data) {
            echo json_encode(array('status' => 1, 'timestamp' => date('Y-m-d H:i:s')));
            break;
        } 
        usleep(25000);
    }
}

JS

function startPoll(timestamp) {
    $.ajax({
        url: 'dashboard/longPolling',
        type: 'POST',
        dataType: 'json',
        timeout: 30000,
        cache: false,
        data: {
            timestamp: timestamp
        },
        success: function(data) {
            if (data != null && data.status == 1) {
                oTable.fnReloadAjax();
                timestamp = data.timestamp;
            }
            setTimeout(function(){
                startPoll(timestamp);
            }, 100)
        }

    });
}

P.S. ignore_user_abort is disabled.