summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjessib <jessib@riseup.net>2013-11-21 10:15:12 -0800
committerjessib <jessib@riseup.net>2013-11-21 10:15:12 -0800
commit19eac22510fcb4ad74456cc3872196fa1e63a93d (patch)
treec64b0f429f6dba19695c4988c1b2f15003f23a95
parent2d9100ef03d283d91b2b8be38fc11ee3c2024a84 (diff)
parent7596b6dbfa38d52acd447982e03e26374fb0d747 (diff)
Merge pull request #116 from azul/feature/rake-tasks-for-cleanup
rake tasks for cleanup
-rw-r--r--Gemfile.lock4
-rw-r--r--core/leap_web_core.gemspec2
-rw-r--r--core/lib/tasks/leap_web_core_tasks.rake16
3 files changed, 19 insertions, 3 deletions
diff --git a/Gemfile.lock b/Gemfile.lock
index e6096fd..8d80546 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -25,7 +25,7 @@ PATH
leap_web_core (0.2.5)
couchrest (~> 1.1.3)
couchrest_model (~> 2.0.0)
- couchrest_session_store (~> 0.2.0)
+ couchrest_session_store (~> 0.2.1)
json
rails (~> 3.2.11)
@@ -110,7 +110,7 @@ GEM
couchrest (~> 1.1.3)
mime-types (>= 1.15)
tzinfo (>= 0.3.22)
- couchrest_session_store (0.2.0)
+ couchrest_session_store (0.2.1)
actionpack
couchrest
couchrest_model
diff --git a/core/leap_web_core.gemspec b/core/leap_web_core.gemspec
index e98c892..c745f00 100644
--- a/core/leap_web_core.gemspec
+++ b/core/leap_web_core.gemspec
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
s.add_dependency "couchrest", "~> 1.1.3"
s.add_dependency "couchrest_model", "~> 2.0.0"
- s.add_dependency "couchrest_session_store", "~> 0.2.0"
+ s.add_dependency "couchrest_session_store", "~> 0.2.1"
s.add_dependency "json"
end
diff --git a/core/lib/tasks/leap_web_core_tasks.rake b/core/lib/tasks/leap_web_core_tasks.rake
index 734fae9..ec6abac 100644
--- a/core/lib/tasks/leap_web_core_tasks.rake
+++ b/core/lib/tasks/leap_web_core_tasks.rake
@@ -7,3 +7,19 @@ namespace :couchrest do
end
end
+namespace :cleanup do
+
+ desc "Cleanup all expired session documents"
+ task :sessions => :environment do
+ # make sure this is the same as in
+ # config/initializers/session_store.rb
+ store = CouchRest::Session::Store.new expire_after: 1800
+ store.cleanup(store.expired)
+ end
+
+ desc "Cleanup all expired tokens"
+ task :tokens => :environment do
+ Token.destroy_all_expired
+ end
+end
+