• I was having issues with the Synchronize always complaining about files needed to be sync’d up or down even though I forcefully (via turbolift script) pushed files up and then downloaded them back down so they should have been 100% sync’d.

    After some investigation, it looks like the Rackspace Cloud Files API has a 10k object limit per request. If you are past that limit, this plugin will ignore everything after the first 10k and say you need to be sync’d. Even when you sync, it will tell you you need to resync them because again the 10k object limit.

    Code I used to fix:

    In lib/class.rs_cdn.php on line 199:
    $cdn_objects = array();

    Add:
    $marker = '';

    Replace line 205:
    $objects = $this->container_object()->objectList();

    With

    //Counter for checking max
    $count = 0;
    
    //Looping through multiple requests. 50k hard stop incase something goes wrong.
    while ($marker !== null && $count < 50000) {
    	$objects = $this->container_object()->objectList(array('marker' => $marker));
    	$total   = count($objects);
    
    	foreach ($objects as $object) {
    		// Stock the array
    		$cdn_objects[] = array('fn' => $object['name'], 'fs' => $object['bytes']);
    		$count++;
    		$marker = ($count == $total) ? $object['name'] : null;
    	}
    }

    Comment out lines 211 – 213. They were moved in the above code.

    $cdn_objects = array();
    foreach ($objects as $object) {
    $cdn_objects[] = array('fn' => $object['name'], 'fs' => $object['bytes']);
    }

    On a side note, the plug-in works now but causes huge lag issues when loading the admin page. Anyone know anyway around this? I’m not sure what exactly is causing this.

    As an aside, I modified admin/manage.php to specifically show what needs to be uploaded and downloaded (it helped me debug the issue) rather than total number.

    https://www.ads-software.com/plugins/rackspace-cloud-files-cdn/

  • The topic ‘10k CDN API request limit causes Sync issues’ is closed to new replies.