-
Notifications
You must be signed in to change notification settings - Fork 23
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
base: main
Are you sure you want to change the base?
Conversation
@@ -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()) |
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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.
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 |
Ensured kv table includes a timestamp column for better conflict resolution.
introduces conflict resolution mechanisms in both
Redis
andSQLite
services. It adds timestamp-based conflict detection and resolution inRedisService
, ensuring data integrity during concurrent updates. Similarly, forSqliteService
, the code now includes handling for conflicts using timestamps