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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 310e1e4e7d59b5ab9d9879cb27f14900d97708f8
4
- data.tar.gz: 9a1a320726ccbd15494de05a05b6c5e8b9a58565
3
+ metadata.gz: d6ebfef1211842802f2544583d0166fa06fa48ec
4
+ data.tar.gz: 01dd7f14c0bf339d21f04c877799e7b00afc0cbe
5
5
  SHA512:
6
- metadata.gz: 2bb36e206283477f8356ea498ee2cacae5ac97090ede5f458d9c8a32c97d14cba67c91a2105ff6e20f3b35e9b53f75879e8ee86f9cbdcde10d4a3ed11e109659
7
- data.tar.gz: f19115eee03e3ab399e26c9fa4d5c0884fdc7eede04e7a88339568a7580ab591e49235b39a1909506e6473af7d9a519951a05fdc31bcf37a7da64228d56cffaf
6
+ metadata.gz: 5da371b9c7b85993ff137c8a835fd73b3dbb14b68d04a489ea6814cab85c0ac2b8f697cd02cf30ae7267d22c0737e5645deb8328a7fa6b8aa35bca56d1c4437c
7
+ data.tar.gz: 77b08295b2f6e68d73946c1d9870502114e5bb85e0535311883e8e5d46962379d0bc198674f94651843256d54b8acec86b7e3517413e7e0bac7192ac26fa7136
@@ -1,3 +1,3 @@
1
1
  module Thermos
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
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.select do |beverage|
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.each do |beverage_model|
39
+ beverage_models.find_each do |beverage_model|
42
40
  refill(beverage, beverage_model.send(beverage.lookup_key))
43
41
  end
44
42
  end
Binary file
@@ -47,3 +47,5 @@ Migrating to CreateStores (20160326174530)
47
47
  ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
48
48
  ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
49
49
  ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
50
+ ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
51
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
@@ -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
   (0.1ms) RELEASE SAVEPOINT active_record_1
7518
7518
   (0.4ms) rollback transaction
7519
+ ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
7520
+  (0.1ms) begin transaction
7521
+ Fixture Delete (0.7ms) DELETE FROM "categories"
7522
+ Fixture Insert (0.6ms) 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
+ Fixture Delete (0.2ms) DELETE FROM "category_items"
7524
+ Fixture Insert (0.1ms) 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
+ Fixture Delete (0.1ms) DELETE FROM "products"
7526
+ Fixture Insert (0.1ms) 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
+ Fixture Delete (0.1ms) DELETE FROM "stores"
7528
+ Fixture Insert (0.1ms) 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
+  (0.9ms) commit transaction
7530
+  (0.1ms) begin transaction
7531
+ --------------------------------------------------------------------------
7532
+ ThermosTest: test_accepts_and_can_rebuild_off_of_an_id_other_than_the_'id'
7533
+ --------------------------------------------------------------------------
7534
+ Category Load (0.3ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT 1 [["id", 322908140]]
7535
+ Product Load (0.2ms) SELECT "products".* FROM "products" WHERE "products"."id" = ? LIMIT 1 [["id", 469160771]]
7536
+  (0.1ms) SAVEPOINT active_record_1
7537
+ SQL (0.4ms) UPDATE "categories" SET "name" = ?, "updated_at" = ? WHERE "categories"."id" = ? [["name", "foo"], ["updated_at", "2016-03-27 22:45:44.315783"], ["id", 322908140]]
7538
+ [ActiveJob] Category Load (0.1ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT 1 [["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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
7543
+  (0.0ms) SAVEPOINT active_record_1
7544
+ SQL (0.1ms) UPDATE "products" SET "name" = ?, "updated_at" = ? WHERE "products"."id" = ? [["name", "foo"], ["updated_at", "2016-03-27 22:45:44.331962"], ["id", 469160771]]
7545
+ [ActiveJob] Product Load (0.0ms) SELECT "products".* FROM "products" WHERE "products"."id" = ? LIMIT 1 [["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] Category Load (0.2ms) 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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
7551
+  (0.3ms) rollback transaction
7552
+  (0.1ms) begin transaction
7553
+ ---------------------------------------------------------------------------------------------------------------------------
7554
+ ThermosTest: test_only_rebuilds_cache_for_stated_dependencies,_even_if_another_cache_has_an_associated_model_of_the_primary
7555
+ ---------------------------------------------------------------------------------------------------------------------------
7556
+ Category Load (0.1ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT 1 [["id", 322908140]]
7557
+ Product Load (0.0ms) SELECT "products".* FROM "products" WHERE "products"."id" = ? LIMIT 1 [["id", 469160771]]
7558
+  (0.1ms) SAVEPOINT active_record_1
7559
+ SQL (0.2ms) UPDATE "products" SET "name" = ?, "updated_at" = ? WHERE "products"."id" = ? [["name", "foo"], ["updated_at", "2016-03-27 22:45:44.353675"], ["id", 469160771]]
7560
+ [ActiveJob] Product Load (0.1ms) 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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
7565
+  (0.4ms) rollback transaction
7566
+  (0.1ms) begin transaction
7567
+ ------------------------------------------------------
7568
+ ThermosTest: test_keeps_the_cache_warm_using_keep_warm
7569
+ ------------------------------------------------------
7570
+  (0.1ms) rollback transaction
7571
+  (0.1ms) begin transaction
7572
+ ---------------------------------------------------------------
7573
+ ThermosTest: test_rebuilds_the_cache_on_belongs_to_model_change
7574
+ ---------------------------------------------------------------
7575
+ Category Load (0.2ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT 1 [["id", 322908140]]
7576
+ Store Load (0.1ms) SELECT "stores".* FROM "stores" WHERE "stores"."id" = ? LIMIT 1 [["id", 868874525]]
7577
+  (0.1ms) SAVEPOINT active_record_1
7578
+ SQL (0.3ms) UPDATE "stores" SET "name" = ?, "updated_at" = ? WHERE "stores"."id" = ? [["name", "foo"], ["updated_at", "2016-03-27 22:45:44.371710"], ["id", 868874525]]
7579
+ [ActiveJob] Store Load (0.0ms) 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] Category Load (0.1ms) SELECT "categories".* FROM "categories" INNER JOIN "stores" ON "stores"."id" = "categories"."store_id" WHERE "stores"."id" = ? ORDER BY "categories"."id" ASC LIMIT 1000 [["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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
7585
+  (0.4ms) rollback transaction
7586
+  (0.1ms) begin transaction
7587
+ ---------------------------------------------------------------------
7588
+ ThermosTest: test_rebuilds_the_cache_on_has_many_through_model_change
7589
+ ---------------------------------------------------------------------
7590
+ Category Load (0.2ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT 1 [["id", 322908140]]
7591
+ Product Load (0.0ms) SELECT "products".* FROM "products" WHERE "products"."id" = ? LIMIT 1 [["id", 469160771]]
7592
+  (0.1ms) SAVEPOINT active_record_1
7593
+ SQL (0.2ms) UPDATE "products" SET "name" = ?, "updated_at" = ? WHERE "products"."id" = ? [["name", "foo"], ["updated_at", "2016-03-27 22:45:44.382996"], ["id", 469160771]]
7594
+ [ActiveJob] Product Load (0.0ms) SELECT "products".* FROM "products" WHERE "products"."id" = ? LIMIT 1 [["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] Category Load (0.1ms) 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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
7600
+  (0.5ms) rollback transaction
7601
+  (0.1ms) begin transaction
7602
+ ------------------------------------------------------------
7603
+ ThermosTest: test_rebuilds_the_cache_on_primary_model_change
7604
+ ------------------------------------------------------------
7605
+ Category Load (0.1ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT 1 [["id", 322908140]]
7606
+  (0.2ms) SAVEPOINT active_record_1
7607
+ SQL (0.2ms) UPDATE "categories" SET "name" = ?, "updated_at" = ? WHERE "categories"."id" = ? [["name", "foo"], ["updated_at", "2016-03-27 22:45:44.395108"], ["id", 322908140]]
7608
+ [ActiveJob] Category Load (0.0ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT 1 [["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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
7613
+  (0.5ms) rollback transaction
7614
+  (0.1ms) begin transaction
7615
+ ---------------------------------------------------------
7616
+ ThermosTest: test_keeps_the_cache_warm_using_fill_/_drink
7617
+ ---------------------------------------------------------
7618
+  (0.1ms) rollback transaction
7619
+  (0.2ms) begin transaction
7620
+ -------------------------------------------------------------
7621
+ ThermosTest: test_rebuilds_the_cache_on_has_many_model_change
7622
+ -------------------------------------------------------------
7623
+ Category Load (0.1ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT 1 [["id", 322908140]]
7624
+ CategoryItem Load (0.1ms) SELECT "category_items".* FROM "category_items" WHERE "category_items"."id" = ? LIMIT 1 [["id", 678302810]]
7625
+  (0.1ms) SAVEPOINT active_record_1
7626
+ SQL (0.3ms) 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] CategoryItem Load (0.0ms) SELECT "category_items".* FROM "category_items" WHERE "category_items"."id" = ? LIMIT 1 [["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] Category Load (0.1ms) 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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
7633
+  (0.4ms) rollback transaction
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thermos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Thal