Commit aa78d30
authored
Make distributed session loading asynchronous to improve scalability … (#1209)
* Make distributed session loading asynchronous to improve scalability (#1195)
* Introduce CustomRedisSessionStore to reduce excessive EXPIRE operations in Redis and improve session handling performance.
Converted ProcessRestRequest method in GXRouting.cs to fully async implementation.
* Ensures sessions load asynchronously
* Apply suggestions from FAzzatto
-Simplified exception handling by replacing await Task.FromException(ex) with throw
-Refactored to throw PageNotFoundException directly when the route cannot be handled, removed unnecessary result task, and moved CommitSessionAsync() to a finally block for clearer async flow
Removed CustomRedisSessionStore which was previously used as an experiment to reduce synchronous Redis Refresh calls. Now that LoadAsync is executed at the start of each request, those synchronous Refresh calls no longer appear to be necessary, because they were caused by the previous synchronous load.
* Refactored method to remove the result variable and await tasks directly, preserving the original behavior.
---------
Co-authored-by: claudiamurialdo <c.murialdo@globant.com>
(cherry picked from commit bb22cbb)
# Conflicts:
# dotnet/src/dotnetcore/GxClasses.Web/Middleware/GXRouting.cs
# dotnet/src/dotnetcore/GxNetCoreStartup/SessionHelper.cs
# dotnet/src/dotnetcore/GxNetCoreStartup/Startup.cs
# dotnet/src/dotnetframework/GxClasses/Helpers/HttpHelper.cs
* Update SessionHelper.cs
* Update SessionHelper.cs
* Update SessionHelper.cs1 parent ed3e062 commit aa78d30
File tree
6 files changed
+146
-127
lines changed- dotnet/src
- dotnetcore
- GxClasses.Web/Middleware
- GxClasses/Domain
- GxNetCoreStartup
- dotnetframework/GxClasses/Helpers
6 files changed
+146
-127
lines changedLines changed: 42 additions & 36 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
177 | | - | |
| 177 | + | |
178 | 178 | | |
179 | | - | |
| 179 | + | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
| 182 | + | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
191 | | - | |
192 | 191 | | |
193 | 192 | | |
194 | 193 | | |
| |||
220 | 219 | | |
221 | 220 | | |
222 | 221 | | |
223 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
224 | 226 | | |
225 | 227 | | |
226 | 228 | | |
227 | | - | |
| 229 | + | |
228 | 230 | | |
229 | 231 | | |
230 | 232 | | |
231 | | - | |
| 233 | + | |
232 | 234 | | |
233 | 235 | | |
234 | 236 | | |
235 | 237 | | |
236 | 238 | | |
237 | | - | |
| 239 | + | |
238 | 240 | | |
239 | 241 | | |
240 | 242 | | |
241 | | - | |
| 243 | + | |
242 | 244 | | |
243 | 245 | | |
244 | 246 | | |
245 | | - | |
| 247 | + | |
246 | 248 | | |
247 | 249 | | |
248 | 250 | | |
249 | | - | |
| 251 | + | |
250 | 252 | | |
251 | 253 | | |
252 | 254 | | |
253 | | - | |
| 255 | + | |
254 | 256 | | |
255 | 257 | | |
256 | 258 | | |
| |||
284 | 286 | | |
285 | 287 | | |
286 | 288 | | |
287 | | - | |
| 289 | + | |
288 | 290 | | |
289 | 291 | | |
290 | | - | |
291 | | - | |
292 | | - | |
| 292 | + | |
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
298 | | - | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
299 | 303 | | |
300 | 304 | | |
301 | 305 | | |
| |||
374 | 378 | | |
375 | 379 | | |
376 | 380 | | |
377 | | - | |
| 381 | + | |
| 382 | + | |
378 | 383 | | |
379 | | - | |
| 384 | + | |
380 | 385 | | |
381 | 386 | | |
382 | | - | |
| 387 | + | |
383 | 388 | | |
384 | 389 | | |
385 | | - | |
386 | | - | |
| 390 | + | |
| 391 | + | |
387 | 392 | | |
388 | 393 | | |
389 | 394 | | |
390 | | - | |
| 395 | + | |
391 | 396 | | |
392 | 397 | | |
393 | 398 | | |
| |||
431 | 436 | | |
432 | 437 | | |
433 | 438 | | |
434 | | - | |
| 439 | + | |
435 | 440 | | |
436 | 441 | | |
437 | 442 | | |
| |||
498 | 503 | | |
499 | 504 | | |
500 | 505 | | |
501 | | - | |
| 506 | + | |
502 | 507 | | |
503 | 508 | | |
504 | 509 | | |
| |||
524 | 529 | | |
525 | 530 | | |
526 | 531 | | |
527 | | - | |
| 532 | + | |
528 | 533 | | |
529 | 534 | | |
530 | 535 | | |
| |||
575 | 580 | | |
576 | 581 | | |
577 | 582 | | |
578 | | - | |
| 583 | + | |
| 584 | + | |
579 | 585 | | |
580 | 586 | | |
581 | 587 | | |
| |||
676 | 682 | | |
677 | 683 | | |
678 | 684 | | |
679 | | - | |
| 685 | + | |
680 | 686 | | |
681 | 687 | | |
682 | 688 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| |||
Lines changed: 6 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
35 | | - | |
| 37 | + | |
36 | 38 | | |
37 | | - | |
38 | | - | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
| 41 | + | |
56 | 42 | | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
| 43 | + | |
63 | 44 | | |
64 | 45 | | |
65 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
73 | 72 | | |
74 | 73 | | |
75 | 74 | | |
| |||
0 commit comments