Download & Extend

Question About the cron job

Project:Stock API
Version:6.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

I have to update a lot of stocks via cron.

for example sake I will use smaller numbers:

let's say I have to update 100 symbols and I want the cron job to process 20 at a time and each stock updated once daily.

Based on your code

 
function stockapi_cron() {
if (time() - variable_get('stockapi_fetch_last', 0) > variable_get('stockapi_fetch', STOCKAPI_CRON_UPDATE_FREQUENCY)) {
    $result = db_query_range('SELECT symbol FROM {stockapi_list} ORDER BY updated', 0, variable_get('stockapi_rows', STOCKAPI_CRON_ROWS_PER_FREQ));
    while ($data = db_fetch_object($result)) {
      if ($stock = stockapi_fetch($data->symbol)) {
        stockapi_save($stock);
      }
    }
    variable_set('stockapi_fetch_last', time());
    cache_clear_all('variables', 'cache');
    watchdog('cron', t('Stock API updated.'));
  }
}

only 20 symbols would be updated per day instead of 5 cron runs totaling 100 symbols to make sure all symbols were updated once a day.

Am I understanding this correctly?

-Trevor