summaryrefslogtreecommitdiff
path: root/src/ingestor.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2025-08-23 19:26:59 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2025-08-25 16:02:44 +0100
commite30cbf9fef8922abef4cc44ad8628d4eef5d28a9 (patch)
treefce01562e2743bda9b0095ec2b7fd08ed77e9e38 /src/ingestor.cpp
parenta84be46d879ad3bde0e4a0890ef1108bf5e10b0b (diff)
downloadwebstat-e30cbf9fef8922abef4cc44ad8628d4eef5d28a9.tar.bz2
webstat-e30cbf9fef8922abef4cc44ad8628d4eef5d28a9.tar.xz
webstat-e30cbf9fef8922abef4cc44ad8628d4eef5d28a9.zip
Track existing entities, don't attempt reinsert
This is an ever growing set, but in theory should be finite, and is only 4bytes per entity.
Diffstat (limited to 'src/ingestor.cpp')
-rw-r--r--src/ingestor.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ingestor.cpp b/src/ingestor.cpp
index e316e84..8547745 100644
--- a/src/ingestor.cpp
+++ b/src/ingestor.cpp
@@ -121,10 +121,14 @@ namespace WebStat {
size_t
Ingestor::storeEntity(const Entity entity) const
{
+ if (existingEntities.contains(entity.first)) {
+ return 0;
+ }
auto insert = dbconn->modify(SQL::ENTITY_INSERT, SQL::ENTITY_INSERT_OPTS);
insert->bindParamI(0, entity.first);
insert->bindParamS(1, entity.second);
insert->execute();
+ existingEntities.emplace(entity.first);
return 1;
}