Skip to main content
deleted 925 characters in body
Source Link
Sasha
  • 254
  • 3
  • 14

It was too complicated description of the task, so let me edit it and simplify: I need a Drupal 7 function (data collection function) to be periodically triggered in the background but only a while a logged in.

Use case is that we need bunch of data from the remote server to display to the user and it takes long time for all the data to be (1) copied from the remote server, (2) upload to local Drupal database and (3) finally to display to the user. So we don't want the user to wait, but to do some other staff and display the data little bit later when it is ready.

So scenario is like this:

  • User logs in to Drupal 7 website and start browsing pages without any delay.
  • At the moment when he/she log's in we need to trigger a Drupal function in a custom module that starts to perform steps (1) and (2) in the background. So user again doesn't feel any delays.
  • When the data is pulled and uploaded to the local Drupal 7 database, the system starts displaying it to the user.

Is it so difficult or impossible for Drupal to trigger a function in the background independently of whatever user is doing on the website only for the period of time while he/she is in the session?

It was too complicated description of the task, so let me edit it and simplify: I need a Drupal 7 function (data collection function) to be periodically triggered in the background but only a while a logged in.

Is it so difficult or impossible for Drupal to trigger a function in the background independently of whatever user is doing on the website only for the period of time while he/she is in the session?

It was too complicated description of the task, so let me edit it and simplify: I need a Drupal 7 function (data collection function) to be periodically triggered in the background but only a while a logged in.

Use case is that we need bunch of data from the remote server to display to the user and it takes long time for all the data to be (1) copied from the remote server, (2) upload to local Drupal database and (3) finally to display to the user. So we don't want the user to wait, but to do some other staff and display the data little bit later when it is ready.

So scenario is like this:

  • User logs in to Drupal 7 website and start browsing pages without any delay.
  • At the moment when he/she log's in we need to trigger a Drupal function in a custom module that starts to perform steps (1) and (2) in the background. So user again doesn't feel any delays.
  • When the data is pulled and uploaded to the local Drupal 7 database, the system starts displaying it to the user.

Is it so difficult or impossible for Drupal to trigger a function in the background independently of whatever user is doing on the website only for the period of time while he/she is in the session?

deleted 925 characters in body
Source Link
Sasha
  • 254
  • 3
  • 14

What isIt was too complicated description of the best way to frequently triggertask, so let me edit it and simplify: I need a quite heavyDrupal 7 function (which pulls a large chunk of statistical data per user from remote serverdata collection function) to be periodically triggered in the background but only for the while a user is browsing respective pages ofwhile a Drupal 7 website?logged in.

Unfortunately, I can't just trigger the function on every page user visits just becauseIs it dramatically slows down page loads. At the same time I needso difficult or impossible for Drupal to display a usertrigger a processed part of the data provided by that function. Now displaying part is easy - we are using https://www.drupal.org/project/views_autorefresh module to regularly pull in the data and display tobackground independently of whatever user. However, regularly triggering the function to get data updated is a tricky part.

I want the website users enjoy fast browsingdoing on the website pages without having to waitonly for the function to finish loading the dataperiod of time while viewing frequently updated data in the https://www.drupal.org/project/views_autorefresh block. So I thought to create a temporary cron job triggering the functionhe/she is in a custom module, which needs to stop working when the user leaves (stops browsing) the website, but reviewing all the Drupal cron modules couldn't find the proper one.

But maybe I am looking at a wrong direction and maybe I don't need to use cron at all and there is much simpler solutionsession? Would appreciate any advise on this. Thanks!

What is the best way to frequently trigger a quite heavy function (which pulls a large chunk of statistical data per user from remote server) in the background only for the while a user is browsing respective pages of a Drupal 7 website?

Unfortunately, I can't just trigger the function on every page user visits just because it dramatically slows down page loads. At the same time I need to display a user a processed part of the data provided by that function. Now displaying part is easy - we are using https://www.drupal.org/project/views_autorefresh module to regularly pull the data and display to user. However, regularly triggering the function to get data updated is a tricky part.

I want the website users enjoy fast browsing the website pages without having to wait for the function to finish loading the data while viewing frequently updated data in the https://www.drupal.org/project/views_autorefresh block. So I thought to create a temporary cron job triggering the function in a custom module, which needs to stop working when the user leaves (stops browsing) the website, but reviewing all the Drupal cron modules couldn't find the proper one.

But maybe I am looking at a wrong direction and maybe I don't need to use cron at all and there is much simpler solution? Would appreciate any advise on this. Thanks!

It was too complicated description of the task, so let me edit it and simplify: I need a Drupal 7 function (data collection function) to be periodically triggered in the background but only a while a logged in.

Is it so difficult or impossible for Drupal to trigger a function in the background independently of whatever user is doing on the website only for the period of time while he/she is in the session?

Source Link
Sasha
  • 254
  • 3
  • 14

Execute Drupal function in background, maybe with cron, for the duration of a user session

What is the best way to frequently trigger a quite heavy function (which pulls a large chunk of statistical data per user from remote server) in the background only for the while a user is browsing respective pages of a Drupal 7 website?

Unfortunately, I can't just trigger the function on every page user visits just because it dramatically slows down page loads. At the same time I need to display a user a processed part of the data provided by that function. Now displaying part is easy - we are using https://www.drupal.org/project/views_autorefresh module to regularly pull the data and display to user. However, regularly triggering the function to get data updated is a tricky part.

I want the website users enjoy fast browsing the website pages without having to wait for the function to finish loading the data while viewing frequently updated data in the https://www.drupal.org/project/views_autorefresh block. So I thought to create a temporary cron job triggering the function in a custom module, which needs to stop working when the user leaves (stops browsing) the website, but reviewing all the Drupal cron modules couldn't find the proper one.

But maybe I am looking at a wrong direction and maybe I don't need to use cron at all and there is much simpler solution? Would appreciate any advise on this. Thanks!