]> git.sesse.net Git - skvidarsync/blobdiff - bin/ws.pl
Communicate through NOTIFY/LISTEN instead of a file.
[skvidarsync] / bin / ws.pl
index 1e4da98db41a3ae6812a1f36c275da86f4951292..69c7b1dcdc8cb65813aa7ffaf069e2675af3be4b 100644 (file)
--- a/bin/ws.pl
+++ b/bin/ws.pl
@@ -97,8 +97,7 @@ sub ws_cb {
 
 sub mark {
        print STDERR "Marking that a sync is needed.\n";
-       open my $fh, ">", "/srv/skvidar-slack.sesse.net/marker";
-       close $fh;
+       $dbh->do('NOTIFY skvupdate');
 }
 
 sub handle_event {
@@ -139,7 +138,7 @@ sub handle_event {
        if ($type eq 'reaction_added' || $type eq 'reaction_removed') {
                $dbh->do('INSERT INTO reaction_log (userid, channel, ts, reaction, event_type, event_ts) VALUES (?,?,?,?,?,?)', undef,
                        $user, $channel, $ts, $reaction, $type, $event_ts);
-               mark();
+               mark($dbh);
        } else {
                print STDERR "Type is $type (not a reaction added or removed); ignoring.\n";
        }