Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix LockingCache expiry behaviour. #44 #57

Merged
merged 4 commits into from
Feb 8, 2013
Merged

Conversation

rcoup
Copy link
Contributor

@rcoup rcoup commented Feb 6, 2013

Fix #44, make the cache actually cache for the specified timeout rather than until initial callbacks happen.

Also adds some tests around LockingCache.

… cache for the specified timeout rather than until initial callbacks happen
@rcoup
Copy link
Contributor Author

rcoup commented Feb 6, 2013

hmm, just found #16
will think on it a bit more

@rcoup
Copy link
Contributor Author

rcoup commented Feb 7, 2013

ok, updated request special-cases timeout=0 to do the instant-purge behaviour, and makes tilelive-mapnik use it like that. If someone else is using lockingcache (/cough/ me /cough/) then non-0 timeouts work a bit more as expected.

I can't find anything else that uses lockingcache, but I'm happy to revise further if it helps.

@rcoup
Copy link
Contributor Author

rcoup commented Feb 7, 2013

@kkaefer yeah, and timeout=0 maintains that behaviour (and that's what _createMetatileCache() now uses)

@springmeyer
Copy link
Contributor

@rcoup - thanks for the patch. reviewing now, but seeing:

   grid.test.js getGrid() with invalid layer: AssertionError: false == true
    at exports.getGrid() with invalid layer (/Users/dane/projects/tilelive-mapnik/test/grid.test.js:85:16)
    at Test.runParallel (/Users/dane/projects/tilelive-mapnik/node_modules/expresso/bin/expresso:961:13)
    at Test.EventEmitter.emit (events.js:93:17)
    at process.<anonymous> (/Users/dane/projects/tilelive-mapnik/node_modules/expresso/bin/expresso:892:18)
    at process.EventEmitter.emit (events.js:126:20)
    at process.emit (/Users/dane/projects/tilelive-mapnik/node_modules/expresso/bin/expresso:1053:10)
    at report (/Users/dane/projects/tilelive-mapnik/node_modules/expresso/bin/expresso:992:13)
    at process.emit (/Users/dane/projects/tilelive-mapnik/node_modules/expresso/bin/expresso:1050:9)


   lockingcache.test.js later requests get a cached response: AssertionError: 2 == 3
    at exports.later requests get a cached response (/Users/dane/projects/tilelive-mapnik/test/lockingcache.test.js:148:16)
    at Test.runParallel (/Users/dane/projects/tilelive-mapnik/node_modules/expresso/bin/expresso:961:13)
    at Test.EventEmitter.emit (events.js:93:17)
    at process.<anonymous> (/Users/dane/projects/tilelive-mapnik/node_modules/expresso/bin/expresso:892:18)
    at process.EventEmitter.emit (events.js:126:20)
    at process.emit (/Users/dane/projects/tilelive-mapnik/node_modules/expresso/bin/expresso:1053:10)
    at report (/Users/dane/projects/tilelive-mapnik/node_modules/expresso/bin/expresso:992:13)
    at process.emit (/Users/dane/projects/tilelive-mapnik/node_modules/expresso/bin/expresso:1050:9)

@springmeyer
Copy link
Contributor

@rcoup - running this inside the tilelive-mapnik master directory hangs:

var assert = require('assert')
var tilelive = require('./lib/mapnik_backend');
var coords = [0,0,0];
var uri = 'mapnik://./test/data/invalid_interactivity_1.xml'
var ddd = new tilelive(uri, function(err, source) {
    if (err) throw err;
    source.getGrid(coords[0], coords[1], coords[2], function(err, tile, headers) {
        // never gets here, just hangs with patch from #57
        assert.ok(err);
        source.close(function(){});
        console.log('worked!')
    })
});

@springmeyer
Copy link
Contributor

Okay, thanks, all tests passing for me now. I will merge since this maintains the current behavior.

Next up I think we need to 1) move tests to mocha to ensure we are more able to catch possible bugs, and 2) potentially expose options to control the locking cache behavior by options passed to the MapnikSource constructor.

springmeyer pushed a commit that referenced this pull request Feb 8, 2013
Make the LockingCache expiry behavior configurable. #44
@springmeyer springmeyer merged commit d02608e into mapbox:master Feb 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Entries in tiles cache released too early
3 participants