Commit 0465768
refactor(scraper): fix, optimize, refactor (#207)
* refactor(registrationScraper): general cleanup
- replaced export {} syntax with marking each function as export at
declaration
- exported all interfaces
- refactored all scrap*() arrow functions to proper functions with
proper return typing
- added some new interfaces for return types of scrap*() functions
- made all scrap*() functions throw improved errors instead of returning
undefined
* refactor(scraper): major scraper command refactor
- split the main `run()` function into multiple task functions
- task functions may share data between them using properties of the
command object
- tasks should batch updates and run them all in a few queries by using
the `*Many()` method variants of lucid models
- implemented simple async semaphores for ratelimiting
- the number of running parallel fetch and DB tasks is limited and can
be adjusted using commandline flags
- it actually works now (on my machine)
* fix(scraper): eliminate duplicate rows using a constraint
* refactor(scraper): rewrite the archive task in raw SQL
results in a ~40% speedup in that task (~25s -> ~15s)
* ci: bump node version to 22
i need that Set.difference in my scraper
* fix(migrations): keep the lowest ID duplicate group instead of highest
* fix(scraper): reorder group objects after fetching
today's session of pointless debugging was brought to you by today's
sponsor, adonis!
do you want your code to absolutely explode every time you attempt to do
a bulk SQL action?
do you despise the common-sense assumptions, such as the bulk fetch
function returning items in the same order as in the list you provided?
do you like wasting hours sitting in the debugger, inventing new
debugging techniques, such as setting a conditional breakpoint on
`Math.random() < 0.001`?
then adonis is perfect for you!
rewrite your web project in adonis today!
use promo code `mini_bomba` to get 50% more pointless debugging for your
first rewrite and a free database implosion on your first tests in
production!
* fix(frontend): fix connection to api on dev mode
* feat(scraper): vacuum & analyze tables after scrape
* refactor(scraper): minor code cleanup as suggested in code review
- replace () => {return {...};} with () => ({...})
- remove commented-out code
- move utils to their own files in /app/utils
- create '#utils/' subpath imports for /app/utils
---------
Co-authored-by: QamarQ <kamilm@you2.pl>1 parent b0cfb3d commit 0465768
File tree
9 files changed
+613
-265
lines changed- backend
- app
- scrap-registrations
- utils
- commands
- database/migrations
- frontend/src
9 files changed
+613
-265
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
| 3 | + | |
6 | 4 | | |
7 | 5 | | |
8 | 6 | | |
| |||
12 | 10 | | |
13 | 11 | | |
14 | 12 | | |
15 | | - | |
| 13 | + | |
16 | 14 | | |
17 | | - | |
| 15 | + | |
18 | 16 | | |
19 | 17 | | |
20 | | - | |
| 18 | + | |
21 | 19 | | |
22 | 20 | | |
23 | 21 | | |
24 | | - | |
| 22 | + | |
25 | 23 | | |
26 | | - | |
| 24 | + | |
27 | 25 | | |
28 | 26 | | |
29 | | - | |
| 27 | + | |
30 | 28 | | |
31 | 29 | | |
32 | | - | |
| 30 | + | |
33 | 31 | | |
34 | 32 | | |
35 | | - | |
| 33 | + | |
36 | 34 | | |
37 | 35 | | |
38 | 36 | | |
| |||
57 | 55 | | |
58 | 56 | | |
59 | 57 | | |
60 | | - | |
61 | | - | |
| 58 | + | |
| 59 | + | |
62 | 60 | | |
63 | 61 | | |
64 | | - | |
65 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
66 | 65 | | |
67 | 66 | | |
68 | 67 | | |
| |||
71 | 70 | | |
72 | 71 | | |
73 | 72 | | |
74 | | - | |
| 73 | + | |
75 | 74 | | |
76 | 75 | | |
77 | 76 | | |
| |||
87 | 86 | | |
88 | 87 | | |
89 | 88 | | |
90 | | - | |
| 89 | + | |
91 | 90 | | |
92 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
97 | | - | |
98 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
| |||
115 | 117 | | |
116 | 118 | | |
117 | 119 | | |
118 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
119 | 125 | | |
120 | | - | |
| 126 | + | |
121 | 127 | | |
122 | | - | |
| 128 | + | |
123 | 129 | | |
124 | 130 | | |
125 | 131 | | |
126 | | - | |
127 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
128 | 135 | | |
129 | 136 | | |
130 | 137 | | |
| |||
142 | 149 | | |
143 | 150 | | |
144 | 151 | | |
145 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
146 | 159 | | |
147 | | - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
148 | 163 | | |
149 | 164 | | |
150 | 165 | | |
151 | 166 | | |
152 | 167 | | |
153 | | - | |
154 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
155 | 171 | | |
156 | 172 | | |
157 | 173 | | |
| |||
186 | 202 | | |
187 | 203 | | |
188 | 204 | | |
189 | | - | |
| 205 | + | |
190 | 206 | | |
191 | | - | |
| 207 | + | |
192 | 208 | | |
193 | 209 | | |
194 | 210 | | |
195 | | - | |
196 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
197 | 214 | | |
198 | 215 | | |
199 | 216 | | |
| |||
207 | 224 | | |
208 | 225 | | |
209 | 226 | | |
210 | | - | |
| 227 | + | |
211 | 228 | | |
212 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
213 | 244 | | |
214 | 245 | | |
215 | | - | |
216 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
217 | 249 | | |
218 | 250 | | |
219 | 251 | | |
| |||
296 | 328 | | |
297 | 329 | | |
298 | 330 | | |
299 | | - | |
| 331 | + | |
300 | 332 | | |
301 | 333 | | |
302 | 334 | | |
| |||
365 | 397 | | |
366 | 398 | | |
367 | 399 | | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
0 commit comments