Merge pull request #4883 from MrZYX/uuid

Use uuids for guid generation
This commit is contained in:
Jason Robinson 2014-04-11 16:40:57 +03:00
commit 6947a1945c
6 changed files with 23 additions and 2 deletions

View file

@ -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)

View file

@ -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'

View file

@ -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

View file

@ -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|

View file

@ -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

View file

@ -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