Skip to content

Commit f0b42a2

Browse files
add logs
1 parent 594fcec commit f0b42a2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

components/notion/sources/updated-page/updated-page.mjs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ export default {
4141
},
4242
hooks: {
4343
async activate() {
44-
console.log("Restarting -- fetching all pages and properties");
45-
const now = new Date();
46-
const propertiesToCheck = await this._getPropertiesToCheck();
44+
console.log("Activating: fetching pages and properties");
45+
this.setLastUpdatedTimestamp(new Date());
4746
const propertyValues = {};
47+
const propertiesToCheck = await this._getPropertiesToCheck();
4848
const params = this.lastUpdatedSortParam();
4949
const pagesStream = this.notion.getPages(this.databaseId, params);
5050
for await (const page of pagesStream) {
@@ -57,9 +57,9 @@ export default {
5757
}
5858
}
5959
this._setPropertyValues(propertyValues);
60-
this.setLastUpdatedTimestamp(now);
6160
},
6261
async deactivate() {
62+
console.log("Deactivating: clearing states");
6363
this.setLastUpdatedTimestamp(null);
6464
},
6565
},
@@ -124,6 +124,7 @@ export default {
124124

125125
if (lastCheckedTimestamp == null) {
126126
// recently updated (deactivated / activated), skip execution
127+
console.log("Awaiting restart completion: skipping execution");
127128
return;
128129
}
129130

0 commit comments

Comments
 (0)