-
Notifications
You must be signed in to change notification settings - Fork 2
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
Improve conflict handling. #3
base: master
Are you sure you want to change the base?
Conversation
acd5e47
to
01bd629
Compare
} else { | ||
$lastModificationTime = null; | ||
$updateTimestamp = \time(); | ||
$currentTimestamp = \time(); |
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.
I wonder what use the default timestamp is? This feature is pretty pointless if the client doesn't specify a timestamp. Perhaps we should only invoke the feature if both the message group ID and a timestamp are provided?
@@ -13,20 +13,21 @@ public function __construct(Context $dbContext, $connectionName = null) | |||
$this->dbConnection = $dbContext->getResources()->getConnection($connectionName); | |||
} | |||
|
|||
public function getLastModificationTime(string $identifier) | |||
public function getLastModification(string $identifier) |
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.
Given that we have X-Message-Group-Id
, shouldn't this method be called getMessageGroup
? And shouldn't the same noun be used elsewhere (e.g. in the table name)?
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.
I agree. getMessageGroup
is better. I am going to make all related names consistent.
{ | ||
$identifier = md5($identifier); | ||
$select = $this->dbConnection->select() | ||
->from(['t' => $this->dbConnection->getTableName('webapi_resource_modification_log')], 'timestamp') | ||
->from(['t' => $this->dbConnection->getTableName('webapi_resource_modification_log')], ['timestamp', 'version']) | ||
->where('t.identifier = ?', $identifier); |
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.
As suggested elsewhere, should this table be called webapi_message_groups
?
], | ||
['identifier = ?' => $identifier, 'timestamp = ?' => $expectedModificationTime] | ||
['identifier = ?' => $identifier, 'timestamp = ?' => $expectedModificationTime, 'version = ?' => $expectedVersion] |
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.
Identifier -> id
baefae9
to
95f3dd2
Compare
Hi @joshdifabio , 84a2abb and 95f3dd2 are changes I made based on your recommendations. Could you please review? |
Hey @joshdifabio, could you please let me know when this PR is merged. Thanks. |
No description provided.