pixl-server-storage 3.1.11 → 3.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -376,8 +376,9 @@ module.exports = Class.create({
376
376
 
377
377
  // check cache first
378
378
  if (this.cache && this.cache.has(key)) {
379
+ var item = this.cache.getMeta(key);
380
+
379
381
  process.nextTick( function() {
380
- var item = self.cache.getMeta(key);
381
382
  self.logDebug(9, "Cached head complete: " + key);
382
383
  callback( null, {
383
384
  mod: item.date,
@@ -420,9 +421,9 @@ module.exports = Class.create({
420
421
 
421
422
  // check cache first
422
423
  if (this.cache && !is_binary && this.cache.has(key)) {
424
+ var data = this.cache.get(key);
425
+
423
426
  process.nextTick( function() {
424
- var data = self.cache.get(key);
425
-
426
427
  try { data = JSON.parse( data ); }
427
428
  catch (e) {
428
429
  self.logError('file', "Failed to parse JSON record: " + key + ": " + e);
package/engines/S3.js CHANGED
@@ -234,8 +234,9 @@ module.exports = Class.create({
234
234
 
235
235
  // check cache first
236
236
  if (this.cache && this.cache.has(orig_key)) {
237
+ var item = this.cache.getMeta(orig_key);
238
+
237
239
  process.nextTick( function() {
238
- var item = self.cache.getMeta(orig_key);
239
240
  self.logDebug(9, "Cached head complete: " + orig_key);
240
241
  callback( null, {
241
242
  mod: item.date,
@@ -285,9 +286,9 @@ module.exports = Class.create({
285
286
 
286
287
  // check cache first
287
288
  if (this.cache && !is_binary && this.cache.has(orig_key)) {
288
- process.nextTick( function() {
289
- var data = self.cache.get(orig_key);
290
-
289
+ var data = this.cache.get(orig_key);
290
+
291
+ process.nextTick( function() {
291
292
  try { data = JSON.parse( data ); }
292
293
  catch (e) {
293
294
  self.logError('file', "Failed to parse JSON record: " + orig_key + ": " + e);
package/hash.js CHANGED
@@ -79,12 +79,12 @@ module.exports = Class.create({
79
79
  _hashShareLock: function(key, wait, callback) {
80
80
  // internal hash shared lock wrapper
81
81
  // uses unique key prefix so won't deadlock with user locks
82
- this.shareLock( '|'+key, wait, callback );
82
+ this.shareLock( 'C|'+key, wait, callback );
83
83
  },
84
84
 
85
85
  _hashShareUnlock: function(key) {
86
86
  // internal hash shared unlock wrapper
87
- this.shareUnlock( '|'+key );
87
+ this.shareUnlock( 'C|'+key );
88
88
  },
89
89
 
90
90
  hashPut: function(path, hkey, hvalue, create_opts, callback) {
package/list.js CHANGED
@@ -111,12 +111,12 @@ module.exports = Class.create({
111
111
  _listShareLock: function(key, wait, callback) {
112
112
  // internal list shared lock wrapper
113
113
  // uses unique key prefix so won't deadlock with user locks
114
- this.shareLock( '|'+key, wait, callback );
114
+ this.shareLock( 'C|'+key, wait, callback );
115
115
  },
116
116
 
117
117
  _listShareUnlock: function(key) {
118
118
  // internal list shared unlock wrapper
119
- this.shareUnlock( '|'+key );
119
+ this.shareUnlock( 'C|'+key );
120
120
  },
121
121
 
122
122
  listPush: function(key, items, create_opts, callback) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixl-server-storage",
3
- "version": "3.1.11",
3
+ "version": "3.1.12",
4
4
  "description": "A key/value/list storage component for the pixl-server framework.",
5
5
  "author": "Joseph Huckaby <jhuckaby@gmail.com>",
6
6
  "homepage": "https://github.com/jhuckaby/pixl-server-storage",
package/transaction.js CHANGED
@@ -741,7 +741,7 @@ module.exports = Class.create({
741
741
  // We must fsync the directory as well, as per: http://man7.org/linux/man-pages/man2/fsync.2.html
742
742
  // Note: Yes, read-only is the only way: https://www.reddit.com/r/node/comments/4r8k11/how_to_call_fsync_on_a_directory/
743
743
  fs.open( Path.dirname(trans.log), "r", function(err, dh) {
744
- if (err) return callback(err);
744
+ if (err) return callback(); // this may fail on certain OSes, so treat as non-fatal
745
745
 
746
746
  fs.fsync(dh, function(err) {
747
747
  // ignoring error here, as some filesystems may not allow this