Skip to content
This repository has been archived by the owner on Aug 17, 2021. It is now read-only.

Commit

Permalink
change default store, global bug fixes
Browse files Browse the repository at this point in the history
Defaults to storing in memory instead of redis to make deployment
easier, Fixed an in issue with global when no posts are in the store
yet, also made sure maxid doesn't go under post id 1
  • Loading branch information
neuroscr committed Jul 17, 2014
1 parent a70aa2d commit affd888
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions dataaccess.caminte.js
Expand Up @@ -13,7 +13,8 @@ var Schema = require('caminte').Schema;

// set up the (eventually configureable) model pools
// 6379 is default redis port number
var schemaData = new Schema('redis', {port: 6379}); //port number depends on your configuration
var schemaDataType = 'memory';
var schemaData = new Schema(schemaDataType, {port: 6379}); //port number depends on your configuration

// Auth models and accessors can be moved into own file?
// so that routes.* can access them separately from everything!
Expand Down Expand Up @@ -217,7 +218,7 @@ setInterval(function () {
// dispatcher's output handles this for now
//process.stdout.write("\n");
// if using redis
if (1) {
if (schemaDataType=='redis') {
//console.dir(schemaAuth.client.server_info);
// just need a redis info call to pull memory and keys stats
// evicted_keys, expired_keys are interesting, keyspace_hits/misses
Expand Down Expand Up @@ -527,7 +528,15 @@ module.exports = {
var count=Math.abs(params.count);
var maxid=null;
postModel.find().order('id','DESC').limit(1).run({},function(err,posts) {
maxid=posts[0].id;
if (posts.length) {
maxid=posts[0].id;
}
if (maxid<20) {
// by default downloads the last 20 posts from the id passed in
// so use 20 so we don't go negative
// FIXME: change to scoping in params adjustment
maxid=20;
}
//console.log('max post id in data store is '+maxid);

if (params.before_id) {
Expand Down

0 comments on commit affd888

Please sign in to comment.