Skip to content

Commit 594281b

Browse files
Jeff DutilJeff Dutil
authored andcommitted
Fix more references to attribute types.
1 parent ffd0c28 commit 594281b

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

lib/aws/session_store/dynamo_db/locking/base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def data_unchanged?(env, session)
143143

144144
# Expected attributes
145145
def expected_attributes(sid)
146-
{ :expected => {@config.table_key => {:value => {:s => sid}, :exists => true}} }
146+
{ :expected => {@config.table_key => {:value => sid, :exists => true}} }
147147
end
148148

149149
# Attributes to be retrieved via client

lib/aws/session_store/dynamo_db/locking/null.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
1313

14-
1514
module AWS::SessionStore::DynamoDB::Locking
1615
# This class gets and sets sessions
1716
# without a locking strategy.
@@ -32,9 +31,8 @@ def get_session_opts(sid)
3231

3332
# @return [String] Session data.
3433
def extract_data(env, result = nil)
35-
env['rack.initial_data'] = result[:item]["data"][:s] if result[:item]
36-
unpack_data(result[:item]["data"][:s]) if result[:item]
34+
env['rack.initial_data'] = result[:item]['data'] if result[:item]
35+
unpack_data(result[:item]['data']) if result[:item]
3736
end
38-
3937
end
4038
end

lib/aws/session_store/dynamo_db/locking/pessimistic.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ def get_lock_time_opts(sid)
7070
# @return [Time] Time stamp for which the session was locked.
7171
def lock_time(sid)
7272
result = @config.dynamo_db_client.get_item(get_lock_time_opts(sid))
73-
(result[:item]["locked_at"][:n]).to_f if result[:item]["locked_at"]
73+
result[:item]["locked_at"].to_f if result[:item]["locked_at"]
7474
end
7575

7676
# @return [String] Session data.
7777
def get_data(env, result)
78-
lock_time = result[:attributes]["locked_at"][:n]
78+
lock_time = result[:attributes]["locked_at"]
7979
env["locked_at"] = (lock_time).to_f
80-
env['rack.initial_data'] = result[:item]["data"][:s] if result[:item]
81-
unpack_data(result[:attributes]["data"][:s])
80+
env['rack.initial_data'] = result[:item]["data"] if result[:item]
81+
unpack_data(result[:attributes]["data"])
8282
end
8383

8484
# Attempt to bust the lock if the expiration date has expired.
@@ -119,7 +119,7 @@ def lock_attr
119119

120120
# Time in which session was updated.
121121
def updated_at
122-
{ :value => {:n => "#{(Time.now).to_f}"}, :action => "PUT" }
122+
{ :value => Time.now.to_f.to_s, :action => "PUT" }
123123
end
124124

125125
# Attributes for locking.
@@ -147,7 +147,7 @@ def add_attr
147147
# Expectation of when lock was set.
148148
def expect_lock_time(env)
149149
{ :expected => {"locked_at" => {
150-
:value => {:n => "#{env["locked_at"]}"}, :exists => true}} }
150+
:value => env["locked_at"].to_s, :exists => true}} }
151151
end
152152

153153
# Attributes to be retrieved via client

spec/aws/session_store/dynamo_db/rack_middleware_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def ensure_data_updated(mutated_data)
5050
client.stub(:delete_item) { 'Deleted' }
5151
client.stub(:list_tables) { {:table_names => ['Sessions']} }
5252
client.stub(:get_item) do
53-
{ :item => { 'data' => { :s => sample_packed_data } } }
53+
{ :item => { 'data' => sample_packed_data } }
5454
end
5555
client.stub(:update_item) do
5656
{ :attributes => { :created_at => 'now' } }

0 commit comments

Comments
 (0)