sarumont / py-trello

Python API wrapper around Trello's API
BSD 3-Clause "New" or "Revised" License
945 stars 330 forks source link

Lazy load property trello.Board.date_last_activity #281

Closed delucks closed 5 years ago

delucks commented 5 years ago

This change puts the get_last_activity method behind a lazy-loaded property decorator, like many other properties in this library.

I found that some initialization-time network calls were being made by trello.Board when investigating a performance regression with a project using py-trello bumping versions between 0.9.0 and 0.11.3. The addition of get_last_activity to the constructor of trello.Board means that a call to trello.TrelloConnection.list_boards will incur N+1 network round-trips, where N is the count of boards returned by list_boards. This changes that behavior, so now list_boards only performs 1 network call.

All tests pass as well!