{"action":"created","comment":{"url":"https://api.github.com/repos/os-autoinst/openQA/pulls/comments/325616581","pull_request_review_id":289842258,"id":325616581,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMyNTYxNjU4MQ==","diff_hunk":"@@ -1055,12 +1055,19 @@ sub update_backend {\n \n sub insert_module {\n     my ($self, $tm) = @_;\n-    my $r = $self->modules->find_or_new({name => $tm->{name}});\n-    if (!$r->in_storage) {\n-        $r->category($tm->{category});\n-        $r->script($tm->{script});\n+\n+    my $r;\n+    my $modules = $self->modules;\n+    try {\n+        $r = $modules->new({name => $tm->{name}, category => $tm->{category}, script => $tm->{script}});","path":"lib/OpenQA/Schema/Result/Jobs.pm","position":12,"original_position":12,"commit_id":"213771c25909465a9125eed648d6405ae3648101","original_commit_id":"213771c25909465a9125eed648d6405ae3648101","user":{"login":"coolo","id":1067203,"node_id":"MDQ6VXNlcjEwNjcyMDM=","avatar_url":"https://avatars1.githubusercontent.com/u/1067203?v=4","gravatar_id":"","url":"https://api.github.com/users/coolo","html_url":"https://github.com/coolo","followers_url":"https://api.github.com/users/coolo/followers","following_url":"https://api.github.com/users/coolo/following{/other_user}","gists_url":"https://api.github.com/users/coolo/gists{/gist_id}","starred_url":"https://api.github.com/users/coolo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coolo/subscriptions","organizations_url":"https://api.github.com/users/coolo/orgs","repos_url":"https://api.github.com/users/coolo/repos","events_url":"https://api.github.com/users/coolo/events{/privacy}","received_events_url":"https://api.github.com/users/coolo/received_events","type":"User","site_admin":false},"body":"isn't new+insert = create?","created_at":"2019-09-18T11:16:45Z","updated_at":"2019-09-18T11:16:45Z","html_url":"https://github.com/os-autoinst/openQA/pull/2334#discussion_r325616581","pull_request_url":"https://api.github.com/repos/os-autoinst/openQA/pulls/2334","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/os-autoinst/openQA/pulls/comments/325616581"},"html":{"href":"https://github.com/os-autoinst/openQA/pull/2334#discussion_r325616581"},"pull_request":{"href":"https://api.github.com/repos/os-autoinst/openQA/pulls/2334"}}},"pull_request":{"url":"https://api.github.com/repos/os-autoinst/openQA/pulls/2334","id":318757569,"node_id":"MDExOlB1bGxSZXF1ZXN0MzE4NzU3NTY5","html_url":"https://github.com/os-autoinst/openQA/pull/2334","diff_url":"https://github.com/os-autoinst/openQA/pull/2334.diff","patch_url":"https://github.com/os-autoinst/openQA/pull/2334.patch","issue_url":"https://api.github.com/repos/os-autoinst/openQA/issues/2334","number":2334,"state":"open","locked":false,"title":"Records in the job_modules table need to be unique","user":{"login":"kraih","id":30094,"node_id":"MDQ6VXNlcjMwMDk0","avatar_url":"https://avatars3.githubusercontent.com/u/30094?v=4","gravatar_id":"","url":"https://api.github.com/users/kraih","html_url":"https://github.com/kraih","followers_url":"https://api.github.com/users/kraih/followers","following_url":"https://api.github.com/users/kraih/following{/other_user}","gists_url":"https://api.github.com/users/kraih/gists{/gist_id}","starred_url":"https://api.github.com/users/kraih/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kraih/subscriptions","organizations_url":"https://api.github.com/users/kraih/orgs","repos_url":"https://api.github.com/users/kraih/repos","events_url":"https://api.github.com/users/kraih/events{/privacy}","received_events_url":"https://api.github.com/users/kraih/received_events","type":"User","site_admin":false},"body":"This resolves the problem we were seeing on the staging machines with records in the`job_modules` table sometimes having duplicates if the worker->webui status update was slowed down due to heavy load (resulting in false negative job results).\r\n\r\nI'm not really happy with the `try`/`catch` in `OpenQA::Schema::Result::Jobs`, but `DBIx::Class` does not currently support real PostgreSQL upserts, so it's probably the best we can do for now. I've tested the duplicate record cleanup SQL in `dbicdh/PostgreSQL/upgrade/80-81/001-unique_job_modules.sql` on OSD, and the migration there should take roughly 1-2 minutes (it is also safe to run the delete manually in advance).","created_at":"2019-09-18T11:11:54Z","updated_at":"2019-09-18T11:16:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"82935cbbc7d7e7a4f949f7a55aa0e3975dc01355","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/os-autoinst/openQA/pulls/2334/commits","review_comments_url":"https://api.github.com/repos/os-autoinst/openQA/pulls/2334/comments","review_comment_url":"https://api.github.com/repos/os-autoinst/openQA/pulls/comments{/number}","comments_url":"https://api.github.com/repos/os-autoinst/openQA/issues/2334/comments","statuses_url":"https://api.github.com/repos/os-autoinst/openQA/statuses/213771c25909465a9125eed648d6405ae3648101","head":{"label":"kraih:unique_modules","ref":"unique_modules","sha":"213771c25909465a9125eed648d6405ae3648101","user":{"login":"kraih","id":30094,"node_id":"MDQ6VXNlcjMwMDk0","avatar_url":"https://avatars3.githubusercontent.com/u/30094?v=4","gravatar_id":"","url":"https://api.github.com/users/kraih","html_url":"https://github.com/kraih","followers_url":"https://api.github.com/users/kraih/followers","following_url":"https://api.github.com/users/kraih/following{/other_user}","gists_url":"https://api.github.com/users/kraih/gists{/gist_id}","starred_url":"https://api.github.com/users/kraih/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kraih/subscriptions","organizations_url":"https://api.github.com/users/kraih/orgs","repos_url":"https://api.github.com/users/kraih/repos","events_url":"https://api.github.com/users/kraih/events{/privacy}","received_events_url":"https://api.github.com/users/kraih/received_events","type":"User","site_admin":false},"repo":{"id":156867387,"node_id":"MDEwOlJlcG9zaXRvcnkxNTY4NjczODc=","name":"openQA","full_name":"kraih/openQA","private":false,"owner":{"login":"kraih","id":30094,"node_id":"MDQ6VXNlcjMwMDk0","avatar_url":"https://avatars3.githubusercontent.com/u/30094?v=4","gravatar_id":"","url":"https://api.github.com/users/kraih","html_url":"https://github.com/kraih","followers_url":"https://api.github.com/users/kraih/followers","following_url":"https://api.github.com/users/kraih/following{/other_user}","gists_url":"https://api.github.com/users/kraih/gists{/gist_id}","starred_url":"https://api.github.com/users/kraih/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kraih/subscriptions","organizations_url":"https://api.github.com/users/kraih/orgs","repos_url":"https://api.github.com/users/kraih/repos","events_url":"https://api.github.com/users/kraih/events{/privacy}","received_events_url":"https://api.github.com/users/kraih/received_events","type":"User","site_admin":false},"html_url":"https://github.com/kraih/openQA","description":"openQA web-frontend, scheduler and tools.","fork":true,"url":"https://api.github.com/repos/kraih/openQA","forks_url":"https://api.github.com/repos/kraih/openQA/forks","keys_url":"https://api.github.com/repos/kraih/openQA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kraih/openQA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kraih/openQA/teams","hooks_url":"https://api.github.com/repos/kraih/openQA/hooks","issue_events_url":"https://api.github.com/repos/kraih/openQA/issues/events{/number}","events_url":"https://api.github.com/repos/kraih/openQA/events","assignees_url":"https://api.github.com/repos/kraih/openQA/assignees{/user}","branches_url":"https://api.github.com/repos/kraih/openQA/branches{/branch}","tags_url":"https://api.github.com/repos/kraih/openQA/tags","blobs_url":"https://api.github.com/repos/kraih/openQA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kraih/openQA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kraih/openQA/git/refs{/sha}","trees_url":"https://api.github.com/repos/kraih/openQA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kraih/openQA/statuses/{sha}","languages_url":"https://api.github.com/repos/kraih/openQA/languages","stargazers_url":"https://api.github.com/repos/kraih/openQA/stargazers","contributors_url":"https://api.github.com/repos/kraih/openQA/contributors","subscribers_url":"https://api.github.com/repos/kraih/openQA/subscribers","subscription_url":"https://api.github.com/repos/kraih/openQA/subscription","commits_url":"https://api.github.com/repos/kraih/openQA/commits{/sha}","git_commits_url":"https://api.github.com/repos/kraih/openQA/git/commits{/sha}","comments_url":"https://api.github.com/repos/kraih/openQA/comments{/number}","issue_comment_url":"https://api.github.com/repos/kraih/openQA/issues/comments{/number}","contents_url":"https://api.github.com/repos/kraih/openQA/contents/{+path}","compare_url":"https://api.github.com/repos/kraih/openQA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kraih/openQA/merges","archive_url":"https://api.github.com/repos/kraih/openQA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kraih/openQA/downloads","issues_url":"https://api.github.com/repos/kraih/openQA/issues{/number}","pulls_url":"https://api.github.com/repos/kraih/openQA/pulls{/number}","milestones_url":"https://api.github.com/repos/kraih/openQA/milestones{/number}","notifications_url":"https://api.github.com/repos/kraih/openQA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kraih/openQA/labels{/name}","releases_url":"https://api.github.com/repos/kraih/openQA/releases{/id}","deployments_url":"https://api.github.com/repos/kraih/openQA/deployments","created_at":"2018-11-09T13:42:08Z","updated_at":"2018-11-09T13:42:12Z","pushed_at":"2019-09-18T11:03:13Z","git_url":"git://github.com/kraih/openQA.git","ssh_url":"git@github.com:kraih/openQA.git","clone_url":"https://github.com/kraih/openQA.git","svn_url":"https://github.com/kraih/openQA","homepage":"http://openqa.opensuse.org/","size":27795,"stargazers_count":0,"watchers_count":0,"language":"Perl","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"os-autoinst:master","ref":"master","sha":"c377d780b5414476e252b799775e081ba75f1f25","user":{"login":"os-autoinst","id":6918706,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY5MTg3MDY=","avatar_url":"https://avatars2.githubusercontent.com/u/6918706?v=4","gravatar_id":"","url":"https://api.github.com/users/os-autoinst","html_url":"https://github.com/os-autoinst","followers_url":"https://api.github.com/users/os-autoinst/followers","following_url":"https://api.github.com/users/os-autoinst/following{/other_user}","gists_url":"https://api.github.com/users/os-autoinst/gists{/gist_id}","starred_url":"https://api.github.com/users/os-autoinst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/os-autoinst/subscriptions","organizations_url":"https://api.github.com/users/os-autoinst/orgs","repos_url":"https://api.github.com/users/os-autoinst/repos","events_url":"https://api.github.com/users/os-autoinst/events{/privacy}","received_events_url":"https://api.github.com/users/os-autoinst/received_events","type":"Organization","site_admin":false},"repo":{"id":20883829,"node_id":"MDEwOlJlcG9zaXRvcnkyMDg4MzgyOQ==","name":"openQA","full_name":"os-autoinst/openQA","private":false,"owner":{"login":"os-autoinst","id":6918706,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY5MTg3MDY=","avatar_url":"https://avatars2.githubusercontent.com/u/6918706?v=4","gravatar_id":"","url":"https://api.github.com/users/os-autoinst","html_url":"https://github.com/os-autoinst","followers_url":"https://api.github.com/users/os-autoinst/followers","following_url":"https://api.github.com/users/os-autoinst/following{/other_user}","gists_url":"https://api.github.com/users/os-autoinst/gists{/gist_id}","starred_url":"https://api.github.com/users/os-autoinst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/os-autoinst/subscriptions","organizations_url":"https://api.github.com/users/os-autoinst/orgs","repos_url":"https://api.github.com/users/os-autoinst/repos","events_url":"https://api.github.com/users/os-autoinst/events{/privacy}","received_events_url":"https://api.github.com/users/os-autoinst/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/os-autoinst/openQA","description":"openQA web-frontend, scheduler and tools.","fork":false,"url":"https://api.github.com/repos/os-autoinst/openQA","forks_url":"https://api.github.com/repos/os-autoinst/openQA/forks","keys_url":"https://api.github.com/repos/os-autoinst/openQA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/os-autoinst/openQA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/os-autoinst/openQA/teams","hooks_url":"https://api.github.com/repos/os-autoinst/openQA/hooks","issue_events_url":"https://api.github.com/repos/os-autoinst/openQA/issues/events{/number}","events_url":"https://api.github.com/repos/os-autoinst/openQA/events","assignees_url":"https://api.github.com/repos/os-autoinst/openQA/assignees{/user}","branches_url":"https://api.github.com/repos/os-autoinst/openQA/branches{/branch}","tags_url":"https://api.github.com/repos/os-autoinst/openQA/tags","blobs_url":"https://api.github.com/repos/os-autoinst/openQA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/os-autoinst/openQA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/os-autoinst/openQA/git/refs{/sha}","trees_url":"https://api.github.com/repos/os-autoinst/openQA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/os-autoinst/openQA/statuses/{sha}","languages_url":"https://api.github.com/repos/os-autoinst/openQA/languages","stargazers_url":"https://api.github.com/repos/os-autoinst/openQA/stargazers","contributors_url":"https://api.github.com/repos/os-autoinst/openQA/contributors","subscribers_url":"https://api.github.com/repos/os-autoinst/openQA/subscribers","subscription_url":"https://api.github.com/repos/os-autoinst/openQA/subscription","commits_url":"https://api.github.com/repos/os-autoinst/openQA/commits{/sha}","git_commits_url":"https://api.github.com/repos/os-autoinst/openQA/git/commits{/sha}","comments_url":"https://api.github.com/repos/os-autoinst/openQA/comments{/number}","issue_comment_url":"https://api.github.com/repos/os-autoinst/openQA/issues/comments{/number}","contents_url":"https://api.github.com/repos/os-autoinst/openQA/contents/{+path}","compare_url":"https://api.github.com/repos/os-autoinst/openQA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/os-autoinst/openQA/merges","archive_url":"https://api.github.com/repos/os-autoinst/openQA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/os-autoinst/openQA/downloads","issues_url":"https://api.github.com/repos/os-autoinst/openQA/issues{/number}","pulls_url":"https://api.github.com/repos/os-autoinst/openQA/pulls{/number}","milestones_url":"https://api.github.com/repos/os-autoinst/openQA/milestones{/number}","notifications_url":"https://api.github.com/repos/os-autoinst/openQA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/os-autoinst/openQA/labels{/name}","releases_url":"https://api.github.com/repos/os-autoinst/openQA/releases{/id}","deployments_url":"https://api.github.com/repos/os-autoinst/openQA/deployments","created_at":"2014-06-16T12:23:22Z","updated_at":"2019-09-18T08:23:54Z","pushed_at":"2019-09-18T11:11:55Z","git_url":"git://github.com/os-autoinst/openQA.git","ssh_url":"git@github.com:os-autoinst/openQA.git","clone_url":"https://github.com/os-autoinst/openQA.git","svn_url":"https://github.com/os-autoinst/openQA","homepage":"http://openqa.opensuse.org/","size":31252,"stargazers_count":165,"watchers_count":165,"language":"Perl","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":132,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":10,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":132,"open_issues":10,"watchers":165,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/os-autoinst/openQA/pulls/2334"},"html":{"href":"https://github.com/os-autoinst/openQA/pull/2334"},"issue":{"href":"https://api.github.com/repos/os-autoinst/openQA/issues/2334"},"comments":{"href":"https://api.github.com/repos/os-autoinst/openQA/issues/2334/comments"},"review_comments":{"href":"https://api.github.com/repos/os-autoinst/openQA/pulls/2334/comments"},"review_comment":{"href":"https://api.github.com/repos/os-autoinst/openQA/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/os-autoinst/openQA/pulls/2334/commits"},"statuses":{"href":"https://api.github.com/repos/os-autoinst/openQA/statuses/213771c25909465a9125eed648d6405ae3648101"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"coolo"}}