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

Improve conflict handling. #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Improve conflict handling. #3

wants to merge 3 commits into from

Conversation

meng-tian
Copy link
Contributor

No description provided.

} else {
$lastModificationTime = null;
$updateTimestamp = \time();
$currentTimestamp = \time();

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)

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)?

Copy link
Contributor Author

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);

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]

Choose a reason for hiding this comment

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

Identifier -> id

@meng-tian
Copy link
Contributor Author

Hi @joshdifabio , 84a2abb and 95f3dd2 are changes I made based on your recommendations. Could you please review?

@meng-tian meng-tian self-assigned this Jan 23, 2017
@alexanderwanyoike
Copy link
Contributor

Hey @joshdifabio, could you please let me know when this PR is merged. Thanks.

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

Successfully merging this pull request may close these issues.

3 participants