diff --git a/Changelog.md b/Changelog.md index eaa713c63..8644b628c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,11 @@ # Head +## Change in guid generation + +This version will break federation to pods running on versions prior 0.1.1.0. + +Read more in [#4249](https://github.com/diaspora/diaspora/pull/4249) and [#4883](https://github.com/diaspora/diaspora/pull/4883) + ## Refactor * Drop number of followers from tags page [#4717](https://github.com/diaspora/diaspora/issues/4717) * Remove some unused beta code [#4738](https://github.com/diaspora/diaspora/issues/4738) diff --git a/Gemfile b/Gemfile index a375a0cb1..119008f55 100644 --- a/Gemfile +++ b/Gemfile @@ -50,6 +50,9 @@ gem 'fog', '1.19.0' gem 'mini_magick', '3.7.0' gem 'remotipart', '1.2.1' +# GUID generation +gem 'uuid', '2.3.7' + # Localization gem 'http_accept_language', '1.0.2' diff --git a/Gemfile.lock b/Gemfile.lock index 240a15f81..b8f24b90b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -223,6 +223,8 @@ GEM rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) lumberjack (1.0.4) + macaddr (1.6.1) + systemu (~> 2.5.0) mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) @@ -410,6 +412,7 @@ GEM activemodel (~> 3.0) railties (~> 3.0) subexec (0.2.3) + systemu (2.5.2) test_after_commit (0.2.2) thor (0.18.1) thread_safe (0.1.3) @@ -434,8 +437,10 @@ GEM kgio (~> 2.6) rack raindrops (~> 0.7) - warden (1.2.3) + uuid (2.3.7) + macaddr (~> 1.0) rack (>= 1.0) + warden (1.2.3) webmock (1.16.1) addressable (>= 2.2.7) crack (>= 0.3.2) @@ -530,6 +535,7 @@ DEPENDENCIES typhoeus (= 0.6.7) uglifier (= 2.1.2) unicorn (= 4.8.0) + uuid (= 2.3.7) webmock (= 1.16.1) will_paginate (= 3.0.5) zip-zip diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index 65c6bdec4..a1ff43592 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -44,6 +44,9 @@ Sidekiq.configure_server do |config| ENV['DATABASE_URL'] = "#{database_url}?pool=#{AppConfig.environment.sidekiq.concurrency.get}" ActiveRecord::Base.establish_connection end + + # Make sure each Sidekiq process has its own sequence of UUIDs + UUID.generator.next_sequence end Sidekiq.configure_client do |config| diff --git a/config/unicorn.rb b/config/unicorn.rb index e02a9dcc0..52963a762 100644 --- a/config/unicorn.rb +++ b/config/unicorn.rb @@ -48,4 +48,7 @@ end after_fork do |server, worker| # If using preload_app, enable this line ActiveRecord::Base.establish_connection + + # We don't generate uuids in the frontend, but let's be on the safe side + UUID.generator.next_sequence end diff --git a/lib/diaspora/guid.rb b/lib/diaspora/guid.rb index c94e56eac..6f509a543 100644 --- a/lib/diaspora/guid.rb +++ b/lib/diaspora/guid.rb @@ -13,6 +13,6 @@ module Diaspora::Guid # @return [String] The model's guid. def set_guid - self.guid = SecureRandom.hex(8) if self.guid.blank? + self.guid = UUID.generate :compact if self.guid.blank? end end