We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0a010de commit dfc31a2Copy full SHA for dfc31a2
content/academy/expert_scraping_with_apify/solutions/saving_stats.md
@@ -19,18 +19,18 @@ class Stats {
19
errors: {},
20
totalSaved: 0,
21
};
22
-
23
- Apify.events.on('persistState', async () => {
24
- await Apify.setValue('STATS', this.state);
25
- });
26
27
- setInterval(() => console.log(this.state), 10000);
28
}
29
30
async initialize() {
31
const data = await Apify.getValue('STATS');
32
33
if (data) this.state = data;
+
+ Apify.events.on('persistState', async () => {
+ await Apify.setValue('STATS', this.state);
+ });
+ setInterval(() => console.log(this.state), 10000);
34
35
36
addError(url, errorMessage) {
0 commit comments