* [PATCH 1/3] pkg.mk: avoid network for "gem install"
@ 2016-11-01 23:58 Eric Wong
2016-11-01 23:58 ` [PATCH 2/3] use monotonic clock for time comparisons Eric Wong
2016-11-01 23:58 ` [PATCH 3/3] gemspec: bump dependencies Eric Wong
0 siblings, 2 replies; 3+ messages in thread
From: Eric Wong @ 2016-11-01 23:58 UTC (permalink / raw)
To: regurgitator-public; +Cc: Eric Wong
Locally-built gems should not require network access to install.
---
pkg.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pkg.mk b/pkg.mk
index 1e40915..186db53 100644
--- a/pkg.mk
+++ b/pkg.mk
@@ -86,7 +86,7 @@ fix-perms:
gem: $(pkggem)
install-gem: $(pkggem)
- gem install $(CURDIR)/$<
+ gem install --local $(CURDIR)/$<
$(pkggem): manifest fix-perms
gem build $(rfpackage).gemspec
--
EW
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/3] use monotonic clock for time comparisons
2016-11-01 23:58 [PATCH 1/3] pkg.mk: avoid network for "gem install" Eric Wong
@ 2016-11-01 23:58 ` Eric Wong
2016-11-01 23:58 ` [PATCH 3/3] gemspec: bump dependencies Eric Wong
1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2016-11-01 23:58 UTC (permalink / raw)
To: regurgitator-public; +Cc: Eric Wong
This requires Ruby 2.1+, but that's a few years old at this
point and should be widely installed by whatever users
we have.
---
lib/regurgitator.rb | 4 ++++
lib/regurgitator/device.rb | 14 +++++++-------
lib/regurgitator/domain.rb | 6 +++---
lib/regurgitator/server_settings.rb | 6 +++---
regurgitator.gemspec | 2 ++
5 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/lib/regurgitator.rb b/lib/regurgitator.rb
index f4ffdd7..3a2d439 100644
--- a/lib/regurgitator.rb
+++ b/lib/regurgitator.rb
@@ -36,4 +36,8 @@ module Regurgitator
# raised by FileRequest when the HTTP status code
# is outside of (200-299, 304)
BadResponse = Class.new(Error) # :nodoc:
+
+ def self.now # :nodoc:
+ Process.clock_gettime(Process::CLOCK_MONOTONIC)
+ end
end
diff --git a/lib/regurgitator/device.rb b/lib/regurgitator/device.rb
index ecd661a..04014aa 100644
--- a/lib/regurgitator/device.rb
+++ b/lib/regurgitator/device.rb
@@ -14,9 +14,9 @@ module Regurgitator::Device # :nodoc:
def device_init
server_settings_init
- @device_cache_mtime = Time.at(0)
- @device_cache = nil
- @device_cache_lock = Mutex.new
+ @dev_cache_mtime = 0
+ @dev_cache = nil
+ @dev_cache_lock = Mutex.new
end
def self.extended(obj)
@@ -31,11 +31,11 @@ module Regurgitator::Device # :nodoc:
# Returns a hash of device info with the Integer +devid+
# as the hash key.
def refresh_device(force = false) # :nodoc:
- @device_cache_lock.synchronize { refresh_device_unlocked(force) }
+ @dev_cache_lock.synchronize { refresh_device_unlocked(force) }
end
def refresh_device_unlocked(force) # :nodoc:
- return @device_cache if ! force && ((Time.now - @device_cache_mtime) < 60)
+ return @dev_cache if !force && ((Regurgitator.now - @dev_cache_mtime) < 60)
tmp = {}.compare_by_identity
refresh_zone(force)
@db[REFRESH_DEVICE].each do |x|
@@ -52,7 +52,7 @@ module Regurgitator::Device # :nodoc:
tmp[devid] = x
end
Regurgitator::Local.refresh_addrs!
- @device_cache_mtime = Time.now
- @device_cache = tmp
+ @dev_cache_mtime = Regurgitator.now
+ @dev_cache = tmp
end
end
diff --git a/lib/regurgitator/domain.rb b/lib/regurgitator/domain.rb
index 5da0989..566f1a2 100644
--- a/lib/regurgitator/domain.rb
+++ b/lib/regurgitator/domain.rb
@@ -6,7 +6,7 @@ module Regurgitator::Domain # :nodoc:
def domain_init
@domain_lock = Mutex.new
- @domain_cache_mtime = Time.at(0)
+ @domain_cache_mtime = 0
@domain_cache = nil
end
@@ -24,10 +24,10 @@ module Regurgitator::Domain # :nodoc:
end
def refresh_domain_unlocked # :nodoc:
- return @domain_cache if ((Time.now - @domain_cache_mtime) < 15)
+ return @domain_cache if ((Regurgitator.now - @domain_cache_mtime) < 15)
tmp = {}
@db[REFRESH_DOMAIN].each { |x| tmp[x[:namespace].freeze] = x[:dmid] }
- @domain_cache_mtime = Time.now
+ @domain_cache_mtime = Regurgitator.now
@domain_cache = tmp
end
end
diff --git a/lib/regurgitator/server_settings.rb b/lib/regurgitator/server_settings.rb
index 9df7667..998a0a4 100644
--- a/lib/regurgitator/server_settings.rb
+++ b/lib/regurgitator/server_settings.rb
@@ -5,7 +5,7 @@ module Regurgitator::ServerSettings # :nodoc:
SETTINGS_LOOKUP = 'SELECT value FROM server_settings WHERE field = ? LIMIT 1'
def server_settings_init
- @zone_cache_mtime = Time.at(0)
+ @zone_cache_mtime = 0
@zone_cache = nil
@zone_cache_lock = Mutex.new
end
@@ -19,7 +19,7 @@ module Regurgitator::ServerSettings # :nodoc:
end
def refresh_zone_unlocked(force)
- return @zone_cache if ! force && ((Time.now - @zone_cache_mtime) < 60)
+ return @zone_cache if !force && ((Regurgitator.now-@zone_cache_mtime) < 60)
tmp = Patricia.new
begin
row = @db[SETTINGS_LOOKUP, 'network_zones'].first or return tmp
@@ -31,7 +31,7 @@ module Regurgitator::ServerSettings # :nodoc:
end
end
ensure
- @zone_cache_mtime = Time.now
+ @zone_cache_mtime = Regurgitator.now
return @zone_cache = tmp
end
end
diff --git a/regurgitator.gemspec b/regurgitator.gemspec
index e840cfc..2fd7872 100644
--- a/regurgitator.gemspec
+++ b/regurgitator.gemspec
@@ -23,5 +23,7 @@ Gem::Specification.new do |s|
s.add_dependency("http_spew", ["~> 0.4", ">= 0.4.1" ])
s.add_dependency("rpatricia", ["~> 1.0"])
s.add_development_dependency('olddoc', "~> 1.0")
+
+ s.required_ruby_version = '>= 2.1'
s.licenses = %w(GPL-2.0+)
end
--
EW
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 3/3] gemspec: bump dependencies
2016-11-01 23:58 [PATCH 1/3] pkg.mk: avoid network for "gem install" Eric Wong
2016-11-01 23:58 ` [PATCH 2/3] use monotonic clock for time comparisons Eric Wong
@ 2016-11-01 23:58 ` Eric Wong
1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2016-11-01 23:58 UTC (permalink / raw)
To: regurgitator-public; +Cc: Eric Wong
We'll require modern versions since we have few users and can
afford to drop support for old versions.
---
regurgitator.gemspec | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/regurgitator.gemspec b/regurgitator.gemspec
index 2fd7872..9d21979 100644
--- a/regurgitator.gemspec
+++ b/regurgitator.gemspec
@@ -18,9 +18,9 @@ Gem::Specification.new do |s|
s.summary = summary
s.test_files = Dir["test/test_*.rb"]
- s.add_dependency("rack", ["~> 1.3"])
+ s.add_dependency("rack", ['~> 2.0'])
s.add_dependency("sequel", ["~> 4.0"])
- s.add_dependency("http_spew", ["~> 0.4", ">= 0.4.1" ])
+ s.add_dependency("http_spew", ['~> 0.5'])
s.add_dependency("rpatricia", ["~> 1.0"])
s.add_development_dependency('olddoc', "~> 1.0")
--
EW
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-11-01 23:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-01 23:58 [PATCH 1/3] pkg.mk: avoid network for "gem install" Eric Wong
2016-11-01 23:58 ` [PATCH 2/3] use monotonic clock for time comparisons Eric Wong
2016-11-01 23:58 ` [PATCH 3/3] gemspec: bump dependencies Eric Wong
Code repositories for project(s) associated with this public inbox
https://yhbt.net/regurgitator.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).