Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetching Same message at timestamp #1084

Open
Blaygh opened this issue Jun 6, 2024 · 1 comment
Open

Fetching Same message at timestamp #1084

Blaygh opened this issue Jun 6, 2024 · 1 comment

Comments

@Blaygh
Copy link

Blaygh commented Jun 6, 2024

So this my function to fetch new mail after a set data, After 2024-06-05 01:41:32-04:00 the fetches the same mail with the same exact timesstamp even though there is newer mail in the mailbox. But I tweak the time parameter by increasing the previous date by a second it starts retrieving the newer mail

def _read_mail_auto(account, limit = DEFAULT_MAIL_FETCH_NUM,
last_read_file_path = DEFAULT_LAST_READ_PATH,
date = default_date):

''' default date = '2024-06-02 00:00:00-04:00' '''

last_message = read_last_saved(last_read_file_path)
message_cache = list()
try:
    time_filter = datetime.strptime(str(last_message['timestamp']),DATE_FORMAT)

    mailbox = account.mailbox()
    query = mailbox.new_query()
    query = query.on_attribute('receivedDateTime').greater(time_filter)
    
    msg_num = 0
    for message in mailbox.get_messages(query=query,limit=limit):
        print(message.received, message.sender)
        message_cache.append(message)
        msg_num += 1
@Blaygh
Copy link
Author

Blaygh commented Jun 7, 2024

So, I figured out what caused the bug. At that exact timestamp down to the last second, the mailbox received similar but different messages. and when I tried to read the next message after the timestamp, it returned the very first message that that had that timestamp hence the impasse

@Blaygh Blaygh changed the title Fetching Sam Fetching Same message at timestamp Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant