thermos 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/thermos/version.rb +1 -1
- data/lib/thermos.rb +3 -5
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +2 -0
- data/test/dummy/log/test.log +115 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6ebfef1211842802f2544583d0166fa06fa48ec
|
4
|
+
data.tar.gz: 01dd7f14c0bf339d21f04c877799e7b00afc0cbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5da371b9c7b85993ff137c8a835fd73b3dbb14b68d04a489ea6814cab85c0ac2b8f697cd02cf30ae7267d22c0737e5645deb8328a7fa6b8aa35bca56d1c4437c
|
7
|
+
data.tar.gz: 77b08295b2f6e68d73946c1d9870502114e5bb85e0535311883e8e5d46962379d0bc198674f94651843256d54b8acec86b7e3517413e7e0bac7192ac26fa7136
|
data/lib/thermos/version.rb
CHANGED
data/lib/thermos.rb
CHANGED
@@ -26,10 +26,8 @@ module Thermos
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def self.refill_primary_caches(model)
|
29
|
-
@thermos.values.
|
30
|
-
beverage.model == model.class
|
31
|
-
end.each do |beverage|
|
32
|
-
refill(beverage, model.send(beverage.lookup_key))
|
29
|
+
@thermos.values.each do |beverage|
|
30
|
+
refill(beverage, model.send(beverage.lookup_key)) if beverage.model == model.class
|
33
31
|
end
|
34
32
|
end
|
35
33
|
|
@@ -38,7 +36,7 @@ module Thermos
|
|
38
36
|
deps = beverage.deps.select { |dependency| dependency.klass == model.class }
|
39
37
|
deps.each do |dependency|
|
40
38
|
beverage_models = beverage.model.joins(dependency.association).where(dependency.table => { id: model.id })
|
41
|
-
beverage_models.
|
39
|
+
beverage_models.find_each do |beverage_model|
|
42
40
|
refill(beverage, beverage_model.send(beverage.lookup_key))
|
43
41
|
end
|
44
42
|
end
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -47,3 +47,5 @@ Migrating to CreateStores (20160326174530)
|
|
47
47
|
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
48
48
|
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
49
49
|
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
50
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.4ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
51
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
data/test/dummy/log/test.log
CHANGED
@@ -7516,3 +7516,118 @@ ThermosTest: test_accepts_and_can_rebuild_off_of_an_id_other_than_the_'id'
|
|
7516
7516
|
[ActiveJob] Enqueued Thermos::RefillJob (Job ID: 7cdb2f0d-2346-4450-a3dc-1e445215f70f) to Inline(default) with arguments: gid://dummy/Product/469160771
|
7517
7517
|
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
7518
7518
|
[1m[35m (0.4ms)[0m rollback transaction
|
7519
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.5ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
7520
|
+
[1m[35m (0.1ms)[0m begin transaction
|
7521
|
+
[1m[36mFixture Delete (0.7ms)[0m [1mDELETE FROM "categories"[0m
|
7522
|
+
[1m[35mFixture Insert (0.6ms)[0m INSERT INTO "categories" ("name", "created_at", "updated_at", "id", "store_id") VALUES ('baseball', '2016-03-27 22:45:44', '2016-03-27 22:45:44', 322908140, 868874525)
|
7523
|
+
[1m[36mFixture Delete (0.2ms)[0m [1mDELETE FROM "category_items"[0m
|
7524
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "category_items" ("name", "created_at", "updated_at", "id", "category_id", "product_id") VALUES ('baseball glove', '2016-03-27 22:45:44', '2016-03-27 22:45:44', 678302810, 322908140, 469160771)
|
7525
|
+
[1m[36mFixture Delete (0.1ms)[0m [1mDELETE FROM "products"[0m
|
7526
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "products" ("name", "created_at", "updated_at", "id") VALUES ('glove', '2016-03-27 22:45:44', '2016-03-27 22:45:44', 469160771)
|
7527
|
+
[1m[36mFixture Delete (0.1ms)[0m [1mDELETE FROM "stores"[0m
|
7528
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "stores" ("name", "created_at", "updated_at", "id") VALUES ('sports store', '2016-03-27 22:45:44', '2016-03-27 22:45:44', 868874525)
|
7529
|
+
[1m[36m (0.9ms)[0m [1mcommit transaction[0m
|
7530
|
+
[1m[35m (0.1ms)[0m begin transaction
|
7531
|
+
--------------------------------------------------------------------------
|
7532
|
+
ThermosTest: test_accepts_and_can_rebuild_off_of_an_id_other_than_the_'id'
|
7533
|
+
--------------------------------------------------------------------------
|
7534
|
+
[1m[36mCategory Load (0.3ms)[0m [1mSELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT 1[0m [["id", 322908140]]
|
7535
|
+
[1m[35mProduct Load (0.2ms)[0m SELECT "products".* FROM "products" WHERE "products"."id" = ? LIMIT 1 [["id", 469160771]]
|
7536
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
7537
|
+
[1m[35mSQL (0.4ms)[0m UPDATE "categories" SET "name" = ?, "updated_at" = ? WHERE "categories"."id" = ? [["name", "foo"], ["updated_at", "2016-03-27 22:45:44.315783"], ["id", 322908140]]
|
7538
|
+
[ActiveJob] [1m[36mCategory Load (0.1ms)[0m [1mSELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT 1[0m [["id", 322908140]]
|
7539
|
+
[ActiveJob] [Thermos::RefillJob] [253297ea-887a-444b-986f-a0e8428f31d4] Performing Thermos::RefillJob from Inline(default) with arguments: gid://dummy/Category/322908140
|
7540
|
+
[ActiveJob] [Thermos::RefillJob] [253297ea-887a-444b-986f-a0e8428f31d4] Performed Thermos::RefillJob from Inline(default) in 8.39ms
|
7541
|
+
[ActiveJob] Enqueued Thermos::RefillJob (Job ID: 253297ea-887a-444b-986f-a0e8428f31d4) to Inline(default) with arguments: gid://dummy/Category/322908140
|
7542
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
7543
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
7544
|
+
[1m[35mSQL (0.1ms)[0m UPDATE "products" SET "name" = ?, "updated_at" = ? WHERE "products"."id" = ? [["name", "foo"], ["updated_at", "2016-03-27 22:45:44.331962"], ["id", 469160771]]
|
7545
|
+
[ActiveJob] [1m[36mProduct Load (0.0ms)[0m [1mSELECT "products".* FROM "products" WHERE "products"."id" = ? LIMIT 1[0m [["id", 469160771]]
|
7546
|
+
[ActiveJob] [Thermos::RefillJob] [512dcae7-50b9-4ff4-af4e-d8ce7850d7c6] Performing Thermos::RefillJob from Inline(default) with arguments: gid://dummy/Product/469160771
|
7547
|
+
[ActiveJob] [Thermos::RefillJob] [512dcae7-50b9-4ff4-af4e-d8ce7850d7c6] [1m[35mCategory Load (0.2ms)[0m SELECT "categories".* FROM "categories" INNER JOIN "category_items" ON "category_items"."category_id" = "categories"."id" INNER JOIN "products" ON "products"."id" = "category_items"."product_id" WHERE "products"."id" = ? ORDER BY "categories"."id" ASC LIMIT 1000 [["id", 469160771]]
|
7548
|
+
[ActiveJob] [Thermos::RefillJob] [512dcae7-50b9-4ff4-af4e-d8ce7850d7c6] Performed Thermos::RefillJob from Inline(default) in 15.05ms
|
7549
|
+
[ActiveJob] Enqueued Thermos::RefillJob (Job ID: 512dcae7-50b9-4ff4-af4e-d8ce7850d7c6) to Inline(default) with arguments: gid://dummy/Product/469160771
|
7550
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
7551
|
+
[1m[35m (0.3ms)[0m rollback transaction
|
7552
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
7553
|
+
---------------------------------------------------------------------------------------------------------------------------
|
7554
|
+
ThermosTest: test_only_rebuilds_cache_for_stated_dependencies,_even_if_another_cache_has_an_associated_model_of_the_primary
|
7555
|
+
---------------------------------------------------------------------------------------------------------------------------
|
7556
|
+
[1m[35mCategory Load (0.1ms)[0m SELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT 1 [["id", 322908140]]
|
7557
|
+
[1m[36mProduct Load (0.0ms)[0m [1mSELECT "products".* FROM "products" WHERE "products"."id" = ? LIMIT 1[0m [["id", 469160771]]
|
7558
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
7559
|
+
[1m[36mSQL (0.2ms)[0m [1mUPDATE "products" SET "name" = ?, "updated_at" = ? WHERE "products"."id" = ?[0m [["name", "foo"], ["updated_at", "2016-03-27 22:45:44.353675"], ["id", 469160771]]
|
7560
|
+
[ActiveJob] [1m[35mProduct Load (0.1ms)[0m SELECT "products".* FROM "products" WHERE "products"."id" = ? LIMIT 1 [["id", 469160771]]
|
7561
|
+
[ActiveJob] [Thermos::RefillJob] [2d9dc0d5-3abb-4f96-b1d1-41fe0a488792] Performing Thermos::RefillJob from Inline(default) with arguments: gid://dummy/Product/469160771
|
7562
|
+
[ActiveJob] [Thermos::RefillJob] [2d9dc0d5-3abb-4f96-b1d1-41fe0a488792] Performed Thermos::RefillJob from Inline(default) in 1.73ms
|
7563
|
+
[ActiveJob] Enqueued Thermos::RefillJob (Job ID: 2d9dc0d5-3abb-4f96-b1d1-41fe0a488792) to Inline(default) with arguments: gid://dummy/Product/469160771
|
7564
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
7565
|
+
[1m[35m (0.4ms)[0m rollback transaction
|
7566
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
7567
|
+
------------------------------------------------------
|
7568
|
+
ThermosTest: test_keeps_the_cache_warm_using_keep_warm
|
7569
|
+
------------------------------------------------------
|
7570
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
7571
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
7572
|
+
---------------------------------------------------------------
|
7573
|
+
ThermosTest: test_rebuilds_the_cache_on_belongs_to_model_change
|
7574
|
+
---------------------------------------------------------------
|
7575
|
+
[1m[35mCategory Load (0.2ms)[0m SELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT 1 [["id", 322908140]]
|
7576
|
+
[1m[36mStore Load (0.1ms)[0m [1mSELECT "stores".* FROM "stores" WHERE "stores"."id" = ? LIMIT 1[0m [["id", 868874525]]
|
7577
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
7578
|
+
[1m[36mSQL (0.3ms)[0m [1mUPDATE "stores" SET "name" = ?, "updated_at" = ? WHERE "stores"."id" = ?[0m [["name", "foo"], ["updated_at", "2016-03-27 22:45:44.371710"], ["id", 868874525]]
|
7579
|
+
[ActiveJob] [1m[35mStore Load (0.0ms)[0m SELECT "stores".* FROM "stores" WHERE "stores"."id" = ? LIMIT 1 [["id", 868874525]]
|
7580
|
+
[ActiveJob] [Thermos::RefillJob] [a12a2e46-b324-4a31-94fd-e9e1e8058a5c] Performing Thermos::RefillJob from Inline(default) with arguments: gid://dummy/Store/868874525
|
7581
|
+
[ActiveJob] [Thermos::RefillJob] [a12a2e46-b324-4a31-94fd-e9e1e8058a5c] [1m[36mCategory Load (0.1ms)[0m [1mSELECT "categories".* FROM "categories" INNER JOIN "stores" ON "stores"."id" = "categories"."store_id" WHERE "stores"."id" = ? ORDER BY "categories"."id" ASC LIMIT 1000[0m [["id", 868874525]]
|
7582
|
+
[ActiveJob] [Thermos::RefillJob] [a12a2e46-b324-4a31-94fd-e9e1e8058a5c] Performed Thermos::RefillJob from Inline(default) in 2.62ms
|
7583
|
+
[ActiveJob] Enqueued Thermos::RefillJob (Job ID: a12a2e46-b324-4a31-94fd-e9e1e8058a5c) to Inline(default) with arguments: gid://dummy/Store/868874525
|
7584
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
7585
|
+
[1m[36m (0.4ms)[0m [1mrollback transaction[0m
|
7586
|
+
[1m[35m (0.1ms)[0m begin transaction
|
7587
|
+
---------------------------------------------------------------------
|
7588
|
+
ThermosTest: test_rebuilds_the_cache_on_has_many_through_model_change
|
7589
|
+
---------------------------------------------------------------------
|
7590
|
+
[1m[36mCategory Load (0.2ms)[0m [1mSELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT 1[0m [["id", 322908140]]
|
7591
|
+
[1m[35mProduct Load (0.0ms)[0m SELECT "products".* FROM "products" WHERE "products"."id" = ? LIMIT 1 [["id", 469160771]]
|
7592
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
7593
|
+
[1m[35mSQL (0.2ms)[0m UPDATE "products" SET "name" = ?, "updated_at" = ? WHERE "products"."id" = ? [["name", "foo"], ["updated_at", "2016-03-27 22:45:44.382996"], ["id", 469160771]]
|
7594
|
+
[ActiveJob] [1m[36mProduct Load (0.0ms)[0m [1mSELECT "products".* FROM "products" WHERE "products"."id" = ? LIMIT 1[0m [["id", 469160771]]
|
7595
|
+
[ActiveJob] [Thermos::RefillJob] [8bbb6c4c-98d8-4ed5-ae46-3fbddee78988] Performing Thermos::RefillJob from Inline(default) with arguments: gid://dummy/Product/469160771
|
7596
|
+
[ActiveJob] [Thermos::RefillJob] [8bbb6c4c-98d8-4ed5-ae46-3fbddee78988] [1m[35mCategory Load (0.1ms)[0m SELECT "categories".* FROM "categories" INNER JOIN "category_items" ON "category_items"."category_id" = "categories"."id" INNER JOIN "products" ON "products"."id" = "category_items"."product_id" WHERE "products"."id" = ? ORDER BY "categories"."id" ASC LIMIT 1000 [["id", 469160771]]
|
7597
|
+
[ActiveJob] [Thermos::RefillJob] [8bbb6c4c-98d8-4ed5-ae46-3fbddee78988] Performed Thermos::RefillJob from Inline(default) in 1.95ms
|
7598
|
+
[ActiveJob] Enqueued Thermos::RefillJob (Job ID: 8bbb6c4c-98d8-4ed5-ae46-3fbddee78988) to Inline(default) with arguments: gid://dummy/Product/469160771
|
7599
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
7600
|
+
[1m[35m (0.5ms)[0m rollback transaction
|
7601
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
7602
|
+
------------------------------------------------------------
|
7603
|
+
ThermosTest: test_rebuilds_the_cache_on_primary_model_change
|
7604
|
+
------------------------------------------------------------
|
7605
|
+
[1m[35mCategory Load (0.1ms)[0m SELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT 1 [["id", 322908140]]
|
7606
|
+
[1m[36m (0.2ms)[0m [1mSAVEPOINT active_record_1[0m
|
7607
|
+
[1m[35mSQL (0.2ms)[0m UPDATE "categories" SET "name" = ?, "updated_at" = ? WHERE "categories"."id" = ? [["name", "foo"], ["updated_at", "2016-03-27 22:45:44.395108"], ["id", 322908140]]
|
7608
|
+
[ActiveJob] [1m[36mCategory Load (0.0ms)[0m [1mSELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT 1[0m [["id", 322908140]]
|
7609
|
+
[ActiveJob] [Thermos::RefillJob] [fb08b9d1-2ccc-41e9-ac3b-ee14218d4a03] Performing Thermos::RefillJob from Inline(default) with arguments: gid://dummy/Category/322908140
|
7610
|
+
[ActiveJob] [Thermos::RefillJob] [fb08b9d1-2ccc-41e9-ac3b-ee14218d4a03] Performed Thermos::RefillJob from Inline(default) in 0.77ms
|
7611
|
+
[ActiveJob] Enqueued Thermos::RefillJob (Job ID: fb08b9d1-2ccc-41e9-ac3b-ee14218d4a03) to Inline(default) with arguments: gid://dummy/Category/322908140
|
7612
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
7613
|
+
[1m[36m (0.5ms)[0m [1mrollback transaction[0m
|
7614
|
+
[1m[35m (0.1ms)[0m begin transaction
|
7615
|
+
---------------------------------------------------------
|
7616
|
+
ThermosTest: test_keeps_the_cache_warm_using_fill_/_drink
|
7617
|
+
---------------------------------------------------------
|
7618
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
7619
|
+
[1m[35m (0.2ms)[0m begin transaction
|
7620
|
+
-------------------------------------------------------------
|
7621
|
+
ThermosTest: test_rebuilds_the_cache_on_has_many_model_change
|
7622
|
+
-------------------------------------------------------------
|
7623
|
+
[1m[36mCategory Load (0.1ms)[0m [1mSELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT 1[0m [["id", 322908140]]
|
7624
|
+
[1m[35mCategoryItem Load (0.1ms)[0m SELECT "category_items".* FROM "category_items" WHERE "category_items"."id" = ? LIMIT 1 [["id", 678302810]]
|
7625
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
7626
|
+
[1m[35mSQL (0.3ms)[0m UPDATE "category_items" SET "name" = ?, "updated_at" = ? WHERE "category_items"."id" = ? [["name", "foo"], ["updated_at", "2016-03-27 22:45:44.411992"], ["id", 678302810]]
|
7627
|
+
[ActiveJob] [1m[36mCategoryItem Load (0.0ms)[0m [1mSELECT "category_items".* FROM "category_items" WHERE "category_items"."id" = ? LIMIT 1[0m [["id", 678302810]]
|
7628
|
+
[ActiveJob] [Thermos::RefillJob] [f1892e89-631e-48f0-a946-6d89a40365be] Performing Thermos::RefillJob from Inline(default) with arguments: gid://dummy/CategoryItem/678302810
|
7629
|
+
[ActiveJob] [Thermos::RefillJob] [f1892e89-631e-48f0-a946-6d89a40365be] [1m[35mCategory Load (0.1ms)[0m SELECT "categories".* FROM "categories" INNER JOIN "category_items" ON "category_items"."category_id" = "categories"."id" WHERE "category_items"."id" = ? ORDER BY "categories"."id" ASC LIMIT 1000 [["id", 678302810]]
|
7630
|
+
[ActiveJob] [Thermos::RefillJob] [f1892e89-631e-48f0-a946-6d89a40365be] Performed Thermos::RefillJob from Inline(default) in 1.81ms
|
7631
|
+
[ActiveJob] Enqueued Thermos::RefillJob (Job ID: f1892e89-631e-48f0-a946-6d89a40365be) to Inline(default) with arguments: gid://dummy/CategoryItem/678302810
|
7632
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
7633
|
+
[1m[35m (0.4ms)[0m rollback transaction
|