Perform clean-up upon server shutdown.
| 335 | |
| 336 | // Perform clean-up upon server shutdown. |
| 337 | static void _ShutdownEventHandler |
| 338 | ( |
| 339 | RedisModuleCtx *ctx, |
| 340 | RedisModuleEvent eid, |
| 341 | uint64_t subevent, |
| 342 | void *data |
| 343 | ) { |
| 344 | void RediSearch_CleanupModule(); |
| 345 | if (!getenv("RS_GLOBAL_DTORS")) { // used only with sanitizer or valgrind |
| 346 | return; |
| 347 | } |
| 348 | |
| 349 | // stop cron |
| 350 | Cron_Stop(); |
| 351 | |
| 352 | // stop threads before finalize GraphBLAS |
| 353 | ThreadPools_Destroy(); |
| 354 | |
| 355 | // server is shutting down, finalize GraphBLAS |
| 356 | GrB_finalize(); |
| 357 | |
| 358 | RedisModule_Log(ctx, "notice", "%s", "Clearing RediSearch resources on shutdown"); |
| 359 | RediSearch_CleanupModule(); |
| 360 | |
| 361 | // free global variables |
| 362 | Globals_Free(); |
| 363 | } |
| 364 | |
| 365 | static void _ModuleLoadedHandler |
| 366 | ( |
nothing calls this directly
no test coverage detected