Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove event duplication for service migrations (DO NOT MERGE before publisher changes) #740

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading