Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

back adding the index but with @version -1. load test passes

  • Loading branch information...
commit 163214bd21da2f14e164e3e2c8c226f410ee2e7f 1 parent 82b51fd
@ffissore authored
Showing with 25 additions and 7 deletions.
  1. +6 −6 lib/connect-orientdb.coffee
  2. +19 −1 test/connect-orientdb.test.coffee
View
12 lib/connect-orientdb.coffee
@@ -52,13 +52,13 @@ module.exports = (connect) ->
@db.command "ALTER PROPERTY #{@class_name}.sid NOTNULL true", (err) =>
return callback(err) if err?
-# @db.command "CREATE INDEX #{@class_name}.sid UNIQUE", (err) =>
-# return callback(err) if err?
-
- @db.reload (err) =>
+ @db.command "CREATE INDEX #{@class_name}.sid UNIQUE", (err) =>
return callback(err) if err?
- callback(null, @)
+ @db.reload (err) =>
+ return callback(err) if err?
+
+ callback(null, @)
load_session_doc = (self, sid, callback) ->
self.db.command "SELECT FROM #{self.class_name} WHERE sid = '#{sid}'", (err, results) =>
@@ -83,7 +83,7 @@ module.exports = (connect) ->
session_doc = session_doc || {}
session_doc["@class"] = session_doc["@class"] or @class_name
session_doc.sid = sid
- session_doc["@version"] = -2
+ session_doc["@version"] = -1
if session.cookie && session.cookie._expires
session_doc.expires = new Date(session.cookie._expires)
View
20 test/connect-orientdb.test.coffee
@@ -96,4 +96,22 @@ exports.test_set_length_clear = (done) ->
store.length (err, count) ->
assert.equal 0, count
- done()
+ done()
+
+exports.test_load = (done) ->
+ this.timeout(0)
+ new OrientDBStore options, (err, store) ->
+ sid = "test_load-sid"
+ data =
+ foo: "bar"
+ cookie:
+ _expires: new Date()
+
+ store.set sid, data, (err, session) ->
+ number_of_calls = 10000
+ number_of_calls_done = 0
+ for i in [0...number_of_calls]
+ store.set sid, data, (err, session) ->
+ number_of_calls_done++
+ assert !err?, ["number_of_calls_done #{number_of_calls_done}", err]
+ done() if number_of_calls_done is number_of_calls
Please sign in to comment.
Something went wrong with that request. Please try again.