Software /
code /
prosody
Comparison
plugins/mod_pubsub/pubsub.lib.lua @ 9072:9603a6a1ec85
mod_pubsub: Enforce max_items on insertion
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 31 Jul 2018 20:33:58 +0200 |
parent | 9041:b3bc742ee188 |
child | 9076:00d89430d77e |
comparison
equal
deleted
inserted
replaced
9071:db61e33bbd41 | 9072:9603a6a1ec85 |
---|---|
744 local payload = value.tags[1]; | 744 local payload = value.tags[1]; |
745 data, err = archive:append(user, key, payload, time_now(), publisher); | 745 data, err = archive:append(user, key, payload, time_now(), publisher); |
746 else | 746 else |
747 data, err = archive:delete(user, { key = key; }); | 747 data, err = archive:delete(user, { key = key; }); |
748 end | 748 end |
749 -- TODO archive support for maintaining maximum items | |
750 archive:delete(user, { | |
751 truncate = max_items; | |
752 }); | |
749 if not data then | 753 if not data then |
750 module:log("error", "Unable to set item: %s", err); | 754 module:log("error", "Unable to set item: %s", err); |
751 return nil, err; | 755 return nil, err; |
752 end | 756 end |
753 return data; | 757 return data; |