Skip to content

Commit

Permalink
chore: remove event duplication for service migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
Steinertech9 committed Dec 18, 2024
1 parent 618cc9f commit e44229b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 57 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.9.3] - 2024-12-18

- chore: remove event duplication for service migrations

## [1.9.2] - 2024-10-28

- feat: stop storing the message in the datastore
Expand Down
Binary file modified bun.lockb
Binary file not shown.
33 changes: 0 additions & 33 deletions config/event-duplication.json

This file was deleted.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ard-eventhub",
"version": "1.9.2",
"version": "1.9.3",
"description": "ARD system to distribute real-time (live) metadata for primarily radio broadcasts.",
"main": "./src/ingest/index.js",
"engines": {
Expand Down Expand Up @@ -35,7 +35,7 @@
"dd-trace": "^5.24.0",
"express": "^4.21.1",
"express-openapi-validator": "^5.3.4",
"firebase-admin": "^12.7.0",
"firebase-admin": "^13.0.1",
"google-auth-library": "^9.14.1",
"jsonwebtoken": "^9.0.2",
"luxon": "^3.5.0",
Expand All @@ -51,7 +51,7 @@
"chai-http": "^4.4.0",
"docsify-cli": "^4.4.4",
"license-compliance": "^3.0.1",
"mocha": "^10.7.3",
"mocha": "^11.0.1",
"nodemon": "^3.1.4",
"prettier": "^3.3.3"
},
Expand Down
21 changes: 0 additions & 21 deletions src/ingest/events/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const response = require('../../utils/response')

// load config
const config = require('../../../config')
const eventDuplicationConfig = require('../../../config/event-duplication.json')

const source = 'ingest/events/post'
const DEFAULT_ZONE = 'Europe/Berlin'
Expand Down Expand Up @@ -59,26 +58,6 @@ module.exports = async (req, res) => {
// create custom attributes for pubsub metadata
const attributes = { event: eventName }

// add workaround for stations in migration phase
for (const service of message.services) {
// check if externalID is in duplication config
if (eventDuplicationConfig[service.externalId]) {
// clone service and add new externalId
const newService = structuredClone(service)
newService.externalId = eventDuplicationConfig[service.externalId]

// add to services
message.services.push(newService)

logger.log({
level: 'info',
message: `duplicated event > ${eventName} > ${service.externalId}`,
source,
data: { body: req.body, service, newService },
})
}
}

// compile core hashes and pubsub names for every service
message.services = await Promise.all(
message.services.map((service) => processServices(service, req))
Expand Down

0 comments on commit e44229b

Please sign in to comment.