From fe9d5d1fe3868f5bee1de73847844068235e3ddc Mon Sep 17 00:00:00 2001 From: Rene Vahtel Date: Tue, 27 Oct 2015 14:50:17 +0200 Subject: [PATCH 1/3] Update LICENSE --- LICENSE | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index c9ccc28c6..a9c642b49 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -The MIT License (MIT) +The MIT/X11 License (MIT/X11) Copyright (c) 2014 Estonian Internet Foundation @@ -18,4 +18,6 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +SOFTWARE. + +Except as contained in this notice, the name(s) of the above copyright holders shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization. From a3272fab439efe881a64dd9a9a7dffcbf969d4ef Mon Sep 17 00:00:00 2001 From: Rene Vahtel Date: Tue, 27 Oct 2015 14:52:29 +0200 Subject: [PATCH 2/3] Update LICENSE --- LICENSE | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index a9c642b49..f63a98563 100644 --- a/LICENSE +++ b/LICENSE @@ -20,4 +20,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -Except as contained in this notice, the name(s) of the above copyright holders shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization. +Except as contained in this notice, the name(s) of the above copyright holders +shall not be used in advertising or otherwise to promote the sale, use or other +dealings in this Software without prior written authorization. From 69a9a1158853748729a83e26f61484db1a7d9a72 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Wed, 28 Oct 2015 08:35:08 +0200 Subject: [PATCH 3/3] Story#105664240 Regenerate registrar whois records async --- app/jobs/regenerate_registrar_whoises_job.rb | 10 ++++++++++ app/jobs/regenerate_whois_record_job.rb | 10 ++++++++++ app/models/registrar.rb | 4 ++-- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 app/jobs/regenerate_registrar_whoises_job.rb create mode 100644 app/jobs/regenerate_whois_record_job.rb diff --git a/app/jobs/regenerate_registrar_whoises_job.rb b/app/jobs/regenerate_registrar_whoises_job.rb new file mode 100644 index 000000000..10e13a038 --- /dev/null +++ b/app/jobs/regenerate_registrar_whoises_job.rb @@ -0,0 +1,10 @@ +class RegenerateRegistrarWhoisesJob < Que::Job + def run(registrar_id) + # no return as we want restart job if fails + registrar = Registrar.find(registrar_id) + + registrar.whois_records.select(:id).find_in_batches(batch_size: 20) do |group| + RegenerateWhoisRecordJob.enqueue group.map(&:id) + end + end +end \ No newline at end of file diff --git a/app/jobs/regenerate_whois_record_job.rb b/app/jobs/regenerate_whois_record_job.rb new file mode 100644 index 000000000..6d79e2ea5 --- /dev/null +++ b/app/jobs/regenerate_whois_record_job.rb @@ -0,0 +1,10 @@ +class RegenerateWhoisRecordJob < Que::Job + def run(ids) + ids.each do |id| + record = WhoisRecord.find_by(id: id) + return unless record + + record.save + end + end +end \ No newline at end of file diff --git a/app/models/registrar.rb b/app/models/registrar.rb index 5afaad52e..003956f88 100644 --- a/app/models/registrar.rb +++ b/app/models/registrar.rb @@ -51,10 +51,10 @@ class Registrar < ActiveRecord::Base WHOIS_TRIGGERS = %w(name email phone street city state zip) - after_save :update_whois_records + after_commit :update_whois_records def update_whois_records return true unless changed? && (changes.keys & WHOIS_TRIGGERS).present? - whois_records.map(&:save) # slow currently + RegenerateRegistrarWhoisesJob.enqueue id end after_create :create_cash_account