Race condition in date guessing #1

Open
opened 2023-07-19 19:11:57 +00:00 by gg · 2 comments
Owner

Depending on the time in Japan and the state of the schedule data, dates might be ahead by one day. If the time is midnight or shortly after in Japan, and the schedule has items from the previous day still in it, it'll throw off the date guessing.

image
In this case, id 13 and onward were actually from the previous day and were mistakenly duplicated. The workaround is to not do database insertions near midnight in Japan.

Depending on the time in Japan and the state of the schedule data, dates might be ahead by one day. If the time is midnight or shortly after in Japan, and the schedule has items from the previous day still in it, it'll throw off the date guessing. ![image](/attachments/416860de-b2f7-4b2c-92cc-40838f44d708) In this case, id 13 and onward were actually from the previous day and were mistakenly duplicated. The workaround is to not do database insertions near midnight in Japan.
123 KiB
Author
Owner

More details on what's safe and what's not

The work-around is to avoid doing schedule insertions near midnight JST. I treat it like a database dead zone (for the schedule table) from approximately 22:00 JST to 4:00 JST. However, mscale insertions and video_id updates are unaffected and can safely be done 24/7.

The heart of the problem comes from ambiguity in the schedule API response and my script not being smart enough near this delicate time on boundaries between days.

## More details on what's safe and what's not The work-around is to avoid doing schedule insertions near midnight JST. I treat it like a database dead zone (for the schedule table) from approximately 22:00 JST to 4:00 JST. However, mscale insertions and video_id updates are unaffected and can safely be done 24/7. The heart of the problem comes from ambiguity in the schedule API response and my script not being smart enough near this delicate time on boundaries between days.
Author
Owner

Thoughts on a potential fix

s   = WeatherNews.API.schedule()
jst = astimezone(ZonedDateTime(now(), localzone()), tz"Asia/Tokyo")

hour(jst)   # 0 for midnight hour right now
s[1][:hour] # "23:00" for the potential troublemaker

If both of the above are true, do I need to adjust back one day?

## Thoughts on a potential fix ```julia s = WeatherNews.API.schedule() jst = astimezone(ZonedDateTime(now(), localzone()), tz"Asia/Tokyo") hour(jst) # 0 for midnight hour right now s[1][:hour] # "23:00" for the potential troublemaker ``` If both of the above are true, do I need to adjust back one day?
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: gg/WeatherNews.jl#1
No description provided.