watcher计算过期时间的低级bug
This commit is contained in:
parent
29db14bbe9
commit
88f41fe90c
|
|
@ -22,9 +22,8 @@ exports.getFullProjection = getFullProjection;
|
|||
function makeIntrinsicWatchers(schema) {
|
||||
var _this = this;
|
||||
var watchers = [];
|
||||
var _loop_1 = function (entity) {
|
||||
for (var entity in schema) {
|
||||
var attributes = schema[entity].attributes;
|
||||
var now = Date.now();
|
||||
var expiresAt = attributes.expiresAt, expired = attributes.expired;
|
||||
if (expiresAt && expiresAt.type === 'datetime' && expired && expired.type === 'boolean') {
|
||||
// 如果有定义expiresAt和expired,则自动生成一个检查的watcher
|
||||
|
|
@ -36,7 +35,7 @@ function makeIntrinsicWatchers(schema) {
|
|||
return [2 /*return*/, {
|
||||
expired: false,
|
||||
expiresAt: {
|
||||
$lte: now,
|
||||
$lte: Date.now(),
|
||||
},
|
||||
}];
|
||||
});
|
||||
|
|
@ -47,9 +46,6 @@ function makeIntrinsicWatchers(schema) {
|
|||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
for (var entity in schema) {
|
||||
_loop_1(entity);
|
||||
}
|
||||
return watchers;
|
||||
}
|
||||
|
|
@ -57,10 +53,10 @@ function analyzeActionDefDict(schema, actionDefDict) {
|
|||
var checkers = [];
|
||||
var triggers = [];
|
||||
for (var entity in actionDefDict) {
|
||||
var _loop_2 = function (attr) {
|
||||
var _loop_1 = function (attr) {
|
||||
var def = actionDefDict[entity][attr];
|
||||
var _a = def, stm = _a.stm, is = _a.is;
|
||||
var _loop_3 = function (action) {
|
||||
var _loop_2 = function (action) {
|
||||
var _b, _c;
|
||||
var actionStm = stm[action];
|
||||
var conditionalFilter = typeof actionStm[0] === 'string' ? (_b = {},
|
||||
|
|
@ -91,7 +87,7 @@ function analyzeActionDefDict(schema, actionDefDict) {
|
|||
});
|
||||
};
|
||||
for (var action in stm) {
|
||||
_loop_3(action);
|
||||
_loop_2(action);
|
||||
}
|
||||
if (is) {
|
||||
checkers.push({
|
||||
|
|
@ -123,7 +119,7 @@ function analyzeActionDefDict(schema, actionDefDict) {
|
|||
}
|
||||
};
|
||||
for (var attr in actionDefDict[entity]) {
|
||||
_loop_2(attr);
|
||||
_loop_1(attr);
|
||||
}
|
||||
}
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ function makeIntrinsicWatchers<ED extends EntityDict>(schema: StorageSchema<ED>)
|
|||
for (const entity in schema) {
|
||||
const { attributes } = schema[entity];
|
||||
|
||||
const now = Date.now();
|
||||
const { expiresAt, expired } = attributes;
|
||||
if (expiresAt && expiresAt.type === 'datetime' && expired && expired.type === 'boolean') {
|
||||
// 如果有定义expiresAt和expired,则自动生成一个检查的watcher
|
||||
|
|
@ -35,7 +34,7 @@ function makeIntrinsicWatchers<ED extends EntityDict>(schema: StorageSchema<ED>)
|
|||
return {
|
||||
expired: false,
|
||||
expiresAt: {
|
||||
$lte: now,
|
||||
$lte: Date.now(),
|
||||
},
|
||||
};
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue