Minor fixes related to promise-toolbox.
This commit is contained in:
parent
a9a1472cb7
commit
4514ea8123
@ -1,9 +1,8 @@
|
||||
import assign from 'lodash.assign'
|
||||
import Collection, {ModelAlreadyExists} from '../collection'
|
||||
import difference from 'lodash.difference'
|
||||
import filter from 'lodash.filter'
|
||||
import getKey from 'lodash.keys'
|
||||
import {createClient as createRedisClient, RedisClient, Multi} from 'redis'
|
||||
import {createClient as createRedisClient} from 'redis'
|
||||
|
||||
import {
|
||||
forEach,
|
||||
@ -14,11 +13,6 @@ import {
|
||||
|
||||
// ===================================================================
|
||||
|
||||
assign(RedisClient.prototype, RedisClient.prototype::promisifyAll())
|
||||
assign(Multi.prototype, Multi.prototype::promisifyAll())
|
||||
|
||||
// ===================================================================
|
||||
|
||||
// ///////////////////////////////////////////////////////////////////
|
||||
// Data model:
|
||||
// - prefix +'_id': value of the last generated identifier;
|
||||
@ -47,7 +41,7 @@ export default class Redis extends Collection {
|
||||
|
||||
this.indexes = indexes
|
||||
this.prefix = prefix
|
||||
this.redis = connection || createRedisClient(uri)
|
||||
this.redis = promisifyAll.call(connection || createRedisClient(uri))
|
||||
}
|
||||
|
||||
_extract (ids) {
|
||||
|
@ -308,7 +308,7 @@ export function pSettle (promises) {
|
||||
|
||||
export {
|
||||
all as pAll,
|
||||
FromCallback as pFromCallback,
|
||||
fromCallback as pFromCallback,
|
||||
isPromise,
|
||||
lastly as pFinally,
|
||||
promisify,
|
||||
|
@ -54,7 +54,7 @@ const levelPromise = db => {
|
||||
dbP[name] = db::value
|
||||
} else {
|
||||
dbP[`${name}Sync`] = db::value
|
||||
dbP[name] = promisify(value, { context: db })
|
||||
dbP[name] = value::promisify(db)
|
||||
}
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user