Browse Source

add topics.lastmod file

Byron Jones 6 years ago
parent
commit
2129cd0404
2 changed files with 5 additions and 1 deletions
  1. 3 0
      lib/LogBot/Util.pm
  2. 2 1
      logbot-consumer

+ 3 - 0
lib/LogBot/Util.pm

@@ -176,6 +176,9 @@ sub file_for {
     } elsif ($type eq 'connected') {
         return path_for($config, 'store') . '/connected';
 
+    } elsif ($type eq 'topics_lastmod') {
+        return path_for($config, 'store') . '/topics.lastmod';
+
     } else {
         die $type;
     }

+ 2 - 1
logbot-consumer

@@ -16,7 +16,7 @@ use Encode qw( encode );
 use LogBot::Config qw( find_config load_config reload_config );
 use LogBot::Database qw( dbh execute_with_retry );
 use LogBot::JobQueue ();
-use LogBot::Util qw( event_to_string logbot_init timestamp );
+use LogBot::Util qw( event_to_string file_for logbot_init timestamp touch );
 
 my $config = load_config(find_config(shift)) // die "syntax: logbot-consumer <config file>\n";
 logbot_init($config);
@@ -73,6 +73,7 @@ while (!$quit) {
                 } elsif ($event->{time} > $time && $event->{text} ne $topic) {
                     $dbh->do('UPDATE topics SET time=?, topic=? WHERE id=?',
                         undef, $event->{time}, $event->{text}, $id);
+                    touch(file_for($config, 'topics_lastmod'));
                 }
 
                 return 1;