Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9322405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T04:05:07+00:00 2026-06-19T04:05:07+00:00

Below is the code that i am end up with using successful comet implementation.

  • 0

Below is the code that i am end up with using successful comet implementation.

$lastmodif = isset($this->params['form']['timestamp']) ? $this->params['form']['timestamp'] : 0;
$currentmodif = $already_updated[0]['Update']['lastmodified'];

while ($currentmodif <= $lastmodif)
{
    usleep(5000000);
    clearstatcache();
    $already_updated_new = $this->Update->find('all',array
    (
        'conditions' => array
        ( 
            'Update.receiver_id' =>  $this->Auth->user('id'),
            'Update.table_name' =>  "request_responses"
        )
    ));
    $currentmodif = $already_updated_new[0]['Update']['lastmodified'];
}

$already_updated[0]['Update']['lastmodified'] is the query result for get last updated timestamp of table.

In above code $lastmodif and $currentmodif is the timestamp that is being passed after every successful comet response.

But now problem is that when i am clicking on other links on same page nothing happens but after wait for so long its redirecting.

i think usleep is blocking other HTTP request.

i am using mysql and cakephp please guys guide me what should i do in order to solve this issue.

I have tried to flush when page is called but it shows can not modify header error as output is already sent.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T04:05:08+00:00Added an answer on June 19, 2026 at 4:05 am

    I’ve met similar situation several times. It looks like Session is blocked by your sleeping script.

    How to solve it in CakePHP:
    call session_write_close(); at the start of your script.
    There is no way to do that via Cake’s Session Component or Helper
    Note: If something inside script uses session – Cake will reopen session and hang all requests that use same session again. In this case you will need to close session before sleep or before any operations that take a lot of time to be finished

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below is the code that I'm using in ms access to list the data
I have this javascript code below that uses jquery, it is suppoed to be
Below is my simple asp code that I am using to insert some data
I've come across Objective-C code that declares a variable right below the @implementation line
I have code that looks more or less like the code below but it
Below is the code that I cope with logo printing. The logo is placed
I have the code below that hides and shows the navigational bar. It is
I have a piece of code (below) that can get the text of an
I'm having trouble with the code below that refers to StoredPathName . As Indy
Background: I have a WPF UserControl (MainControl - not shown in code below) that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.