Minor fixes related to promise-toolbox.

This commit is contained in:
Julien Fontanet 2016-02-24 18:22:18 +01:00
parent a9a1472cb7
commit 4514ea8123
3 changed files with 4 additions and 10 deletions

View File

@ -1,9 +1,8 @@
import assign from 'lodash.assign'
import Collection, {ModelAlreadyExists} from '../collection' import Collection, {ModelAlreadyExists} from '../collection'
import difference from 'lodash.difference' import difference from 'lodash.difference'
import filter from 'lodash.filter' import filter from 'lodash.filter'
import getKey from 'lodash.keys' import getKey from 'lodash.keys'
import {createClient as createRedisClient, RedisClient, Multi} from 'redis' import {createClient as createRedisClient} from 'redis'
import { import {
forEach, forEach,
@ -14,11 +13,6 @@ import {
// =================================================================== // ===================================================================
assign(RedisClient.prototype, RedisClient.prototype::promisifyAll())
assign(Multi.prototype, Multi.prototype::promisifyAll())
// ===================================================================
// /////////////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////////////
// Data model: // Data model:
// - prefix +'_id': value of the last generated identifier; // - prefix +'_id': value of the last generated identifier;
@ -47,7 +41,7 @@ export default class Redis extends Collection {
this.indexes = indexes this.indexes = indexes
this.prefix = prefix this.prefix = prefix
this.redis = connection || createRedisClient(uri) this.redis = promisifyAll.call(connection || createRedisClient(uri))
} }
_extract (ids) { _extract (ids) {

View File

@ -308,7 +308,7 @@ export function pSettle (promises) {
export { export {
all as pAll, all as pAll,
FromCallback as pFromCallback, fromCallback as pFromCallback,
isPromise, isPromise,
lastly as pFinally, lastly as pFinally,
promisify, promisify,

View File

@ -54,7 +54,7 @@ const levelPromise = db => {
dbP[name] = db::value dbP[name] = db::value
} else { } else {
dbP[`${name}Sync`] = db::value dbP[`${name}Sync`] = db::value
dbP[name] = promisify(value, { context: db }) dbP[name] = value::promisify(db)
} }
}) })