Add /feedinfo endpoint
[blerg.git] / database / database.c
index 585f508..a45c92b 100644 (file)
@@ -1,3 +1,6 @@
+/* Blerg is (C) 2011 The Dominion of Awesome, and is distributed under a
+ * BSD-style license.  Please see the COPYING file for details.
+ */
 #include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
@@ -10,6 +13,7 @@
 #include <sys/file.h>
 #include <fcntl.h>
 #include "database.h"
+#include "subscription.h"
 #include "util.h"
 #include "config.h"
 
@@ -243,11 +247,12 @@ int blerg_store(struct blerg *blerg, const char *data, int len) {
        blerg->index[seg_rec].length = len;
        blerg->index[seg_rec].timestamp = time(NULL);
 
-       tag_scan(blerg->name, data, len, record);
-
        flock(blerg->data_fd, LOCK_UN);
        flock(blerg->index_fd, LOCK_UN);
 
+       tag_scan(blerg->name, data, len, record);
+       subscription_notify(blerg->name, record);
+
        return record;
 }