Software /
code /
prosody
Diff
util/promise.lua @ 9745:0dbb285f903e
util.promise: Remove references to callbacks after settling promise
This is to help the garbage collector.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 30 Dec 2018 03:24:54 +0100 |
parent | 9562:acf74ad0b795 |
child | 10922:7d3dbb9eb3eb |
line wrap: on
line diff
--- a/util/promise.lua Sun Dec 30 03:20:37 2018 +0100 +++ b/util/promise.lua Sun Dec 30 03:24:54 2018 +0100 @@ -49,6 +49,9 @@ for _, cb in ipairs(cbs) do cb(value); end + -- No need to keep references to callbacks + promise._pending_on_fulfilled = nil; + promise._pending_on_rejected = nil; return true; end