{"action":"created","comment":{"url":"https://api.github.com/repos/guardian/grid/pulls/comments/48977564","id":48977564,"diff_hunk":"@@ -131,19 +131,25 @@ object ElasticSearch extends ElasticSearchClient with ImageFields {\n       .executeAndLog(s\"removing exports from image $id\")\n       .incrementOnFailure(failedExportsUpdates) { case e: VersionConflictEngineException => true }\n \n-  def applyImageMetadataOverride(id: String, metadata: JsValue)(implicit ex: ExecutionContext): Future[UpdateResponse] =\n+  def applyImageMetadataOverride(id: String, metadata: JsValue)(implicit ex: ExecutionContext): Future[UpdateResponse] = {\n+    val userMetaData = metadata \\ \"data\"\n+    val lastModified = metadata \\ \"lastModified\"\n     prepareImageUpdate(id)\n       .setScriptParams(Map(\n-        \"userMetadata\" -> asGroovy(metadata),\n-        \"lastModified\" -> asGroovy(JsString(currentIsoDateString))\n+        \"userMetadata\" -> asGroovy(userMetaData),\n+        \"lastModified\" -> asGroovy(lastModified)\n       ).asJava)\n       .setScript(\n-        \"ctx._source.userMetadata = userMetadata;\" +\n-          refreshEditsScript +\n-          updateLastModifiedScript,\n+      s\"\"\"| if (ctx._source.lastModified && ctx._source.lastModified > lastModified) {} else {","path":"thrall/app/lib/ElasticSearch.scala","position":19,"original_position":19,"commit_id":"1f1d65436592b51db08dbb73bbf4806004fe9e62","original_commit_id":"1f1d65436592b51db08dbb73bbf4806004fe9e62","user":{"login":"jamesgorrie","id":31692,"avatar_url":"https://avatars.githubusercontent.com/u/31692?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesgorrie","html_url":"https://github.com/jamesgorrie","followers_url":"https://api.github.com/users/jamesgorrie/followers","following_url":"https://api.github.com/users/jamesgorrie/following{/other_user}","gists_url":"https://api.github.com/users/jamesgorrie/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesgorrie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesgorrie/subscriptions","organizations_url":"https://api.github.com/users/jamesgorrie/orgs","repos_url":"https://api.github.com/users/jamesgorrie/repos","events_url":"https://api.github.com/users/jamesgorrie/events{/privacy}","received_events_url":"https://api.github.com/users/jamesgorrie/received_events","type":"User","site_admin":false},"body":"Would we want them to be the same? Technically the metadata was updated at some stage, and now we're updating the image. This time difference could be useful?","created_at":"2016-01-06T16:38:31Z","updated_at":"2016-01-06T16:38:31Z","html_url":"https://github.com/guardian/grid/pull/1599#discussion_r48977564","pull_request_url":"https://api.github.com/repos/guardian/grid/pulls/1599","_links":{"self":{"href":"https://api.github.com/repos/guardian/grid/pulls/comments/48977564"},"html":{"href":"https://github.com/guardian/grid/pull/1599#discussion_r48977564"},"pull_request":{"href":"https://api.github.com/repos/guardian/grid/pulls/1599"}}},"pull_request":{"url":"https://api.github.com/repos/guardian/grid/pulls/1599","id":55223943,"html_url":"https://github.com/guardian/grid/pull/1599","diff_url":"https://github.com/guardian/grid/pull/1599.diff","patch_url":"https://github.com/guardian/grid/pull/1599.patch","issue_url":"https://api.github.com/repos/guardian/grid/issues/1599","number":1599,"state":"open","locked":false,"title":"check last modified before updating metadata","user":{"login":"NickPapacostas","id":1441582,"avatar_url":"https://avatars.githubusercontent.com/u/1441582?v=3","gravatar_id":"","url":"https://api.github.com/users/NickPapacostas","html_url":"https://github.com/NickPapacostas","followers_url":"https://api.github.com/users/NickPapacostas/followers","following_url":"https://api.github.com/users/NickPapacostas/following{/other_user}","gists_url":"https://api.github.com/users/NickPapacostas/gists{/gist_id}","starred_url":"https://api.github.com/users/NickPapacostas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NickPapacostas/subscriptions","organizations_url":"https://api.github.com/users/NickPapacostas/orgs","repos_url":"https://api.github.com/users/NickPapacostas/repos","events_url":"https://api.github.com/users/NickPapacostas/events{/privacy}","received_events_url":"https://api.github.com/users/NickPapacostas/received_events","type":"User","site_admin":false},"body":"adding last modified to metadata editor sqs notifications and checking them in thrall before updating","created_at":"2016-01-06T15:22:09Z","updated_at":"2016-01-06T16:38:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7a4b67eef2b02744a1da6767c2c9cd27207a05d0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/guardian/grid/pulls/1599/commits","review_comments_url":"https://api.github.com/repos/guardian/grid/pulls/1599/comments","review_comment_url":"https://api.github.com/repos/guardian/grid/pulls/comments{/number}","comments_url":"https://api.github.com/repos/guardian/grid/issues/1599/comments","statuses_url":"https://api.github.com/repos/guardian/grid/statuses/1f1d65436592b51db08dbb73bbf4806004fe9e62","head":{"label":"guardian:last_modified_thrall","ref":"last_modified_thrall","sha":"1f1d65436592b51db08dbb73bbf4806004fe9e62","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":12298112,"name":"grid","full_name":"guardian/grid","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/grid","description":"The Guardian’s new image management system","fork":false,"url":"https://api.github.com/repos/guardian/grid","forks_url":"https://api.github.com/repos/guardian/grid/forks","keys_url":"https://api.github.com/repos/guardian/grid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/grid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/grid/teams","hooks_url":"https://api.github.com/repos/guardian/grid/hooks","issue_events_url":"https://api.github.com/repos/guardian/grid/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/grid/events","assignees_url":"https://api.github.com/repos/guardian/grid/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/grid/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/grid/tags","blobs_url":"https://api.github.com/repos/guardian/grid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/grid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/grid/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/grid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/grid/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/grid/languages","stargazers_url":"https://api.github.com/repos/guardian/grid/stargazers","contributors_url":"https://api.github.com/repos/guardian/grid/contributors","subscribers_url":"https://api.github.com/repos/guardian/grid/subscribers","subscription_url":"https://api.github.com/repos/guardian/grid/subscription","commits_url":"https://api.github.com/repos/guardian/grid/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/grid/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/grid/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/grid/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/grid/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/grid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/grid/merges","archive_url":"https://api.github.com/repos/guardian/grid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/grid/downloads","issues_url":"https://api.github.com/repos/guardian/grid/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/grid/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/grid/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/grid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/grid/labels{/name}","releases_url":"https://api.github.com/repos/guardian/grid/releases{/id}","created_at":"2013-08-22T13:49:31Z","updated_at":"2016-01-06T13:50:54Z","pushed_at":"2016-01-06T16:35:26Z","git_url":"git://github.com/guardian/grid.git","ssh_url":"git@github.com:guardian/grid.git","clone_url":"https://github.com/guardian/grid.git","svn_url":"https://github.com/guardian/grid","homepage":"","size":13187,"stargazers_count":994,"watchers_count":994,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":52,"mirror_url":null,"open_issues_count":59,"forks":52,"open_issues":59,"watchers":994,"default_branch":"master"}},"base":{"label":"guardian:master","ref":"master","sha":"81516b64647dd8d47d63aded85f4339836a6cd37","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":12298112,"name":"grid","full_name":"guardian/grid","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/grid","description":"The Guardian’s new image management system","fork":false,"url":"https://api.github.com/repos/guardian/grid","forks_url":"https://api.github.com/repos/guardian/grid/forks","keys_url":"https://api.github.com/repos/guardian/grid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/grid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/grid/teams","hooks_url":"https://api.github.com/repos/guardian/grid/hooks","issue_events_url":"https://api.github.com/repos/guardian/grid/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/grid/events","assignees_url":"https://api.github.com/repos/guardian/grid/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/grid/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/grid/tags","blobs_url":"https://api.github.com/repos/guardian/grid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/grid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/grid/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/grid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/grid/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/grid/languages","stargazers_url":"https://api.github.com/repos/guardian/grid/stargazers","contributors_url":"https://api.github.com/repos/guardian/grid/contributors","subscribers_url":"https://api.github.com/repos/guardian/grid/subscribers","subscription_url":"https://api.github.com/repos/guardian/grid/subscription","commits_url":"https://api.github.com/repos/guardian/grid/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/grid/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/grid/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/grid/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/grid/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/grid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/grid/merges","archive_url":"https://api.github.com/repos/guardian/grid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/grid/downloads","issues_url":"https://api.github.com/repos/guardian/grid/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/grid/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/grid/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/grid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/grid/labels{/name}","releases_url":"https://api.github.com/repos/guardian/grid/releases{/id}","created_at":"2013-08-22T13:49:31Z","updated_at":"2016-01-06T13:50:54Z","pushed_at":"2016-01-06T16:35:26Z","git_url":"git://github.com/guardian/grid.git","ssh_url":"git@github.com:guardian/grid.git","clone_url":"https://github.com/guardian/grid.git","svn_url":"https://github.com/guardian/grid","homepage":"","size":13187,"stargazers_count":994,"watchers_count":994,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":52,"mirror_url":null,"open_issues_count":59,"forks":52,"open_issues":59,"watchers":994,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/guardian/grid/pulls/1599"},"html":{"href":"https://github.com/guardian/grid/pull/1599"},"issue":{"href":"https://api.github.com/repos/guardian/grid/issues/1599"},"comments":{"href":"https://api.github.com/repos/guardian/grid/issues/1599/comments"},"review_comments":{"href":"https://api.github.com/repos/guardian/grid/pulls/1599/comments"},"review_comment":{"href":"https://api.github.com/repos/guardian/grid/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/guardian/grid/pulls/1599/commits"},"statuses":{"href":"https://api.github.com/repos/guardian/grid/statuses/1f1d65436592b51db08dbb73bbf4806004fe9e62"}}}}