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

Conflit resolution #24

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

abakermi
Copy link

@abakermi abakermi commented Feb 1, 2024

introduces conflict resolution mechanisms in both Redis and SQLite services. It adds timestamp-based conflict detection and resolution in RedisService, ensuring data integrity during concurrent updates. Similarly, for SqliteService, the code now includes handling for conflicts using timestamps

@@ -30,7 +30,7 @@ export class EntitiesService {

const entityKey = this.getEntityKey(actor, key)

return await this.dataServiceFactory.getService().set(entityKey, value)
return await this.dataServiceFactory.getService().set(entityKey, value,new Date().getTime())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and everywhere else, please enable prettier and use the config in the repo to fix code style issues.

@@ -5,13 +5,13 @@ import { DataService } from '../data-service/data-service.interface'
export class SqliteService implements OnModuleInit, DataService {
private db = null
private sqlite3 = require('sqlite3')
constructor() {}
constructor() { }

async onModuleInit() {
try {
this.db = new this.sqlite3.Database('./database.sqlite')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update SQL to add the column if the table already exists.

@christianmat
Copy link
Contributor

Over-all looks good. Please add some unit tests as well. You can see how to set that up with Nest.js here: https://docs.nestjs.com/fundamentals/testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants