# Deleting Persistent Records on module Shutdown

**URL:** <https://forum.inductiveautomation.com/t/deleting-persistent-records-on-module-shutdown/102019>\
**Category:** Module Development\
**Created:** [February 7, 2025, 12:24am UTC](https://forum.inductiveautomation.com/t/deleting-persistent-records-on-module-shutdown/102019 "2025-02-07T00:24:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![daniel3](https://avatars.discourse-cdn.com/v4/letter/d/a4c791/32.png) [@daniel3](https://forum.inductiveautomation.com/u/daniel3)\
**Post date:** [February 7, 2025, 12:24am UTC](https://forum.inductiveautomation.com/t/deleting-persistent-records-on-module-shutdown/102019/1 "2025-02-07T00:24:42Z")

</div>

Hello,  
I am developing a module that will monitor tags and publish their values into an HTTP API. Everything seems to be working fine except for one small detail: when I uninstall the module I can't seem to find a way to delete all the persistent records and associated Listeners that I created. The side effect is some of the logic I created to poll tags keeps polling them even after uninstall. Any help or example on how to delete all the records and also tables if possible would be very helpful.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 7, 2025, 1:27am UTC](https://forum.inductiveautomation.com/t/deleting-persistent-records-on-module-shutdown/102019/2 "2025-02-07T01:27:43Z")

</div>

Your gateway hook instance gets `.shutdown()` called when uninstalling. Use that. General practice is to **not** delete the records, just to unregister listeners. That pattern is required for module upgrade to run properly.

---

<div class="post-metadata">

**Author:** ![daniel3](https://avatars.discourse-cdn.com/v4/letter/d/a4c791/32.png) [@daniel3](https://forum.inductiveautomation.com/u/daniel3)\
**Post date:** [February 7, 2025, 9:24pm UTC](https://forum.inductiveautomation.com/t/deleting-persistent-records-on-module-shutdown/102019/3 "2025-02-07T21:24:15Z")

</div>

Thanks, I realized that I was actually missing two different things. The module can monitor tags in two different ways: 1) using the `TagChangeListeners` to publish when the value change and 2) using `context.getExecutionManager().register()` to publish based on fixed rate.  
So I needed not only to unsubscribe all my listeners but also unregister and shutdown the` ExecutionManager`.
