Skip to content

is it better to create new DAVClients or reuse one DAVClient for long-term repeated syncing tasks? #612

@throni3git

Description

@throni3git

hi,
thanks for this package. i am working on a calendar syncing app using the DAVClient. as i did not find an example on that topic, how is it supposed to be used for long-term usage with repeated syncing tasks? either closing and creating a new DAVClient for every syncing run or should it be only one DAVClient being used all the time?

e.g. pseudo code

cal_primary = "..."

while True:
    client = caldav.DAVClient(cal_primary, username="...", password="...")
    principal = client.principal()
    calendars = self.principal.calendars()
    # do something with the calendars
    client.close()
   time.sleep(60)

or

cal_primary = "..."
client = caldav.DAVClient(cal_primary, username="...", password="...")
principal = client.principal()

while True:
    calendars = self.principal.calendars()
    # do something with the calendars
   time.sleep(60)

in my use case i use the APScheduler package [1]

[1] https://github.com/agronholm/apscheduler

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions