You should increase timeout for requesting piwik api. Default timeout for drupal_http_request is 30. This is too small for our heavy website.

function piwik_stats_api_request($piwik_url, $token_auth, $method, $site_id, $period = 'year', $date = 'now', $format = 'xml') {
  // Send off the API request.
  return drupal_http_request(
    url($piwik_url,
      array(
        'query' => array(
          'module' => 'API',
          'method' => $method,
          'idSite' => $site_id,
          'period' => $period,
          'date' => $date,
          'format' => $format,
          'token_auth' => $token_auth,
          'expanded' => TRUE,
        ),
      )
    ),array('timeout' => 240 )
  );
}

I have search a while till i found this ;- )

CommentFileSizeAuthor
#1 http_request_timeout-1694518-1.patch1.59 KBpatrickd
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

patrickd’s picture

Status: Active » Fixed
FileSize
1.59 KB

Added a new advanced setting "Piwik API request timeout" to control this.

tested and committed to 7.x-1.x

thanks! :)

patrickd’s picture

(default value is 30 secs)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

patrickd’s picture

Title: Get timeout in drupal_http_request » Make drupal_http_request timeout configurable