# Expiry time not changing

**URL:** <https://forum.codecrafters.io/t/expiry-time-not-changing/2821>\
**Category:** Challenges\
**Tags:** challenge:redis\
**Created:** [November 9, 2024, 5:22am UTC](https://forum.codecrafters.io/t/expiry-time-not-changing/2821 "2024-11-09T05:22:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![shreyasganesh0](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/shreyasganesh0/32/2559_2.png) [@shreyasganesh0](https://forum.codecrafters.io/u/shreyasganesh0)\
**Post date:** [November 9, 2024, 5:22am UTC](https://forum.codecrafters.io/t/expiry-time-not-changing/2821/1 "2024-11-09T05:22:53Z")

</div>

I’m stuck on Stage #(change to your stage, ex. #JM3).

I’ve tried parsing the expiry time but it doesnt update for some reason

Here are my logs:

```auto
{250: {'redis-ver': '7.2.0', 'redis-bits': ''}, 251: {'no_expiry_dict_size': 5, 'expiry_dict_size': 5}, 252: {('mango', 1956528000000, 0): 'pear', ('blueberry', 1956528000000, 0): 'pineapple', ('apple', 1956528000000, 0): 'blueberry', ('strawberry', 1640995200000, 0): 'banana', ('banana', 1956528000000, 0): 'strawberry'}, 253: {}, 254: {'db_number': 0}, 255: {'crcchecksum': '20511923824317112157238'}, 'misc_kvs': {}}
[your_program] 0 byte val curr
[your_program] curr byte header 252
[your_program] in the expiry
[your_program] 252 curr head
[your_program] In 252 b'\x00\x0c(\x8a\xc7\x01\x00\x00'
[your_program] 0
[your_program] time 1956528000000
[your_program] here for now

```

And here’s a snippet of my code:

```python
if current_header_for_data == 252:
                            print("In 252 ",self.file_byte_data[self.position_in_file:self.position_in_file+8])
                            
                            time_expiry_seconds = struct.unpack('<Q', self.file_byte_data[self.position_in_file:self.position_in_file+8])[0]
                            self.position_in_file+=8
                            print(self.file_byte_data[self.position_in_file])
                            #time_expiry_seconds = int.from_bytes(time_expiry_seconds, byteorder='little', signed=False)

                            print("time", time_expiry_seconds)

```

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [November 9, 2024, 10:38am UTC](https://forum.codecrafters.io/t/expiry-time-not-changing/2821/2 "2024-11-09T10:38:39Z")

</div>

Hi @shreyasganesh0, do you mind elaborating a bit on “it doesnt update”?

---

<div class="post-metadata">

**Author:** ![shreyasganesh0](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/shreyasganesh0/32/2559_2.png) [@shreyasganesh0](https://forum.codecrafters.io/u/shreyasganesh0)\
**Post date:** [November 9, 2024, 12:38pm UTC](https://forum.codecrafters.io/t/expiry-time-not-changing/2821/3 "2024-11-09T12:38:50Z")

</div>

I changed the parsing to consider only 7 bytes but im getting the same value for expiry so I wondering if I was missing something. I did just using [self.position\_in\_file:self.position\_in\_file+8] and converting it using int.from\_bytes(time\_expiry\_seconds, byteorder=  
‘little’, signed=False)

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [November 12, 2024, 6:58am UTC](https://forum.codecrafters.io/t/expiry-time-not-changing/2821/5 "2024-11-12T06:58:16Z")

</div>

@shreyasganesh0 Looks like you’ve got past this stage — do you happen to remember what was wrong? Would love to see if we can improve the tester / instructions.

---

<div class="post-metadata">

**Author:** ![shreyasganesh0](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/shreyasganesh0/32/2559_2.png) [@shreyasganesh0](https://forum.codecrafters.io/u/shreyasganesh0)\
**Post date:** [November 12, 2024, 12:14pm UTC](https://forum.codecrafters.io/t/expiry-time-not-changing/2821/7 "2024-11-12T12:14:31Z")

</div>

Oh yeah its beacause it was a unixtime stamp and I handwaved it assuming the datetime packahe would take care of the conversion part.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)\
**Post date:** [November 17, 2024, 12:14pm UTC](https://forum.codecrafters.io/t/expiry-time-not-changing/2821/8 "2024-11-17T12:14:46Z")

</div>

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.
