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

  • Home
  • SEARCH
  • 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 8856791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:26:13+00:00 2026-06-14T14:26:13+00:00

Here is my problem : I have an application that allows users to synchronize

  • 0

Here is my problem : I have an application that allows users to synchronize their data with social networks. The problem is that each synchronization can take up to 10 seconds. So I would like to trigger the synchronization in “background” task, and if possible parallelize all synchronisation.

Currently, my script looks like :

$user =  user::login($username, $password);
/* Do some treatments, display the home page */ 
$user->synchronize();
/* END OF LOGIN SCRIPT */

and in my user.class.php, I have something like

public function synchronize(){
 $Networks = socialNetworks::getByUserId($this->userid);
 foreach($Networks as $n) $n->synchronize();
}

and finally in the socialNetworks.class.php, I have implemented all the synchronization scripts for each social network (fb, linkedin, google+, …).

Note that I don’t need to wait for the result of the synchronization when logging in.

So I have 2 problems here :

  1. when calling $user->synchronize(); the login script is blocked until the end of the loop
  2. the loop itself is very long, and I would like to launch parallel “threads”, to make it faster when calling the synchronize() method (I have some Ajax triggering this action).

What would you suggest to optimize this ?

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-14T14:26:14+00:00Added an answer on June 14, 2026 at 2:26 pm

    One option is to use Gearman, and offload this work to it’s workers.

    You basically create a PHP script that does some work. Then you tell it to do that work from your login script, and the work will be done in the background outside of the request.

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

Sidebar

Related Questions

Well, here is my problem: I have an application that uses a custom Javascript
Here's the core problem: I have a .NET application that is using COM interop
So here is the problem that I am facing: I have an application that
So here is the problem: I have some logic in my application that will
Here is the problem: I have two columns in a table that, for each
We have a web application that allows users to upload photos which will then
I have written an ASP.NET MVC application that allows the user to specify their
I have a non-gae, gwt application and it have a module that allows users
I have a problem here. Right now I'm doing my Web Based Application, my
Here's the problem: I have a data-bound list of items, basically a way for

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.