From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 5AEEC1387B2 for ; Thu, 16 Jan 2014 16:43:44 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9C220E0B7D; Thu, 16 Jan 2014 16:43:43 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 016D4E0B77 for ; Thu, 16 Jan 2014 16:43:42 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 322EB33EEB4 for ; Thu, 16 Jan 2014 16:43:42 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id DFFE81874E for ; Thu, 16 Jan 2014 16:43:39 +0000 (UTC) From: "Alex Legler" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Alex Legler" Message-ID: <1389445685.fcd973a11b093d8969f51a3b712900e85a645f92.a3li@gentoo> Subject: [gentoo-commits] proj/infra-status:master commit in: lib/ X-VCS-Repository: proj/infra-status X-VCS-Files: lib/service_registry.rb X-VCS-Directories: lib/ X-VCS-Committer: a3li X-VCS-Committer-Name: Alex Legler X-VCS-Revision: fcd973a11b093d8969f51a3b712900e85a645f92 X-VCS-Branch: master Date: Thu, 16 Jan 2014 16:43:39 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 0f1923bc-bea5-400d-b858-c537ef840571 X-Archives-Hash: 2920350071e4df654f076f8f3496b4a8 commit: fcd973a11b093d8969f51a3b712900e85a645f92 Author: Alex Legler a3li li> AuthorDate: Sat Jan 11 13:08:05 2014 +0000 Commit: Alex Legler gentoo org> CommitDate: Sat Jan 11 13:08:05 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/infra-status.git;a=commit;h=fcd973a1 Fix recursion in update logic --- lib/service_registry.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/service_registry.rb b/lib/service_registry.rb index 7ac5f85..f21a74a 100644 --- a/lib/service_registry.rb +++ b/lib/service_registry.rb @@ -74,6 +74,7 @@ class ServiceRegistry attr_reader :load_date def initialize + @cache_locked = false end def service(name, &block) @@ -91,15 +92,17 @@ class ServiceRegistry end def update! + @cache_locked = true @services = {} @status_data = JSON.parse(File.read(StatusSource)) load(File.join(File.dirname(__FILE__), '..', 'data', 'services.rb')) @load_date = DateTime.now + @cache_locked = false end private def update? - if not @load_date.nil? and ((DateTime.now - @load_date) * 60 * 60 * 24).to_i > CACHE_SECONDS + if not @load_date.nil? and not @cache_locked and ((DateTime.now - @load_date) * 60 * 60 * 24).to_i > CACHE_SECONDS update! end end From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id CC3D4138247 for ; Sat, 18 Jan 2014 12:10:49 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4ECB6E0C7A; Sat, 18 Jan 2014 12:10:49 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8FB38E0C7A for ; Sat, 18 Jan 2014 12:10:48 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id AEE5333F85F for ; Sat, 18 Jan 2014 12:10:47 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 5614F1872F for ; Sat, 18 Jan 2014 12:10:45 +0000 (UTC) From: "Alex Legler" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Alex Legler" Message-ID: <1389445685.fcd973a11b093d8969f51a3b712900e85a645f92.a3li@gentoo> Subject: [gentoo-commits] proj/infra-status:master commit in: lib/ X-VCS-Repository: proj/infra-status X-VCS-Files: lib/service_registry.rb X-VCS-Directories: lib/ X-VCS-Committer: a3li X-VCS-Committer-Name: Alex Legler X-VCS-Revision: fcd973a11b093d8969f51a3b712900e85a645f92 X-VCS-Branch: master Date: Sat, 18 Jan 2014 12:10:45 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 2077f4b4-acac-4878-b03a-8b1618fe33fd X-Archives-Hash: d7338ce03a3e2cc3e1ae88f2d9e858d3 Message-ID: <20140118121045.QSp-4ZbnYanIpV-0SXNEDAwSVvvjB0XCfhKdX5uzjwo@z> commit: fcd973a11b093d8969f51a3b712900e85a645f92 Author: Alex Legler a3li li> AuthorDate: Sat Jan 11 13:08:05 2014 +0000 Commit: Alex Legler gentoo org> CommitDate: Sat Jan 11 13:08:05 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/infra-status.git;a=commit;h=fcd973a1 Fix recursion in update logic --- lib/service_registry.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/service_registry.rb b/lib/service_registry.rb index 7ac5f85..f21a74a 100644 --- a/lib/service_registry.rb +++ b/lib/service_registry.rb @@ -74,6 +74,7 @@ class ServiceRegistry attr_reader :load_date def initialize + @cache_locked = false end def service(name, &block) @@ -91,15 +92,17 @@ class ServiceRegistry end def update! + @cache_locked = true @services = {} @status_data = JSON.parse(File.read(StatusSource)) load(File.join(File.dirname(__FILE__), '..', 'data', 'services.rb')) @load_date = DateTime.now + @cache_locked = false end private def update? - if not @load_date.nil? and ((DateTime.now - @load_date) * 60 * 60 * 24).to_i > CACHE_SECONDS + if not @load_date.nil? and not @cache_locked and ((DateTime.now - @load_date) * 60 * 60 * 24).to_i > CACHE_SECONDS update! end end