summaryrefslogtreecommitdiff
path: root/lib/VNDB/DB/Tags.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2019-10-07 11:07:57 +0200
committerYorhel <git@yorhel.nl>2019-10-07 11:11:49 +0200
commit65ed955890c7ee7250a2bce4467c8c092c1bbbbe (patch)
tree43dda83ad493e4350dff6af301f5c1a5b6b779aa /lib/VNDB/DB/Tags.pm
parentba02e35cea8f2f25ab0ed1a4fccc8983435f9671 (diff)
SQL: Perform incremental updates on tags_vn_inherit when tags are modified
This has some limitations: - tags.c_items is not updated, so that may be out of sync. (The UPDATE takes about 400ms, so doing that more regularly from Multi::Maintenance should be a viable option) - When the hidden flag of a VN is changed, the tags will also be out of sync. - I don't see a way to do fast incremental updates when tag entries themselves are changed, e.g. to handle changes in the tag tree or searchable flag
Diffstat (limited to 'lib/VNDB/DB/Tags.pm')
-rw-r--r--lib/VNDB/DB/Tags.pm3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/VNDB/DB/Tags.pm b/lib/VNDB/DB/Tags.pm
index 97852724..75be42d8 100644
--- a/lib/VNDB/DB/Tags.pm
+++ b/lib/VNDB/DB/Tags.pm
@@ -237,6 +237,9 @@ sub dbTagLinkEdit {
# update
$self->dbExec('UPDATE tags_vn SET vote = ?, spoiler = ?, date = NOW() WHERE tag = ? AND vid = ? AND uid = ?',
$update->{$_}[0], $update->{$_}[1]<0?undef:$update->{$_}[1], $_, $vid, $uid) for (keys %$update);
+
+ # Update cache
+ $self->dbExec('SELECT tag_vn_calc(?)', $vid);
}