Skip to content

Commit

Permalink
refactor: add lazy field to LibraryCollectionData (#404)
Browse files Browse the repository at this point in the history
This is required to handle the signal asynchronously whenever the sender
does not care about the handler execution completion.

For example, whenever multiple collections are updated due to a
component being added or removed, we do not want to wait for all
collection update handlers to complete.
  • Loading branch information
navinkarkera authored Oct 12, 2024
1 parent f7c8695 commit 03dc087
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ __________



[9.15.0] - 2024-10-10
---------------------

Changed
~~~~~~~

* Added ``background`` field to ``LibraryCollectionData`` so that senders can specify if handlers can run asynchrounously.

[9.14.1] - 2024-09-17
---------------------

Expand Down
2 changes: 1 addition & 1 deletion openedx_events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
more information about the project.
"""

__version__ = "9.14.1"
__version__ = "9.15.0"
3 changes: 3 additions & 0 deletions openedx_events/content_authoring/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,10 @@ class LibraryCollectionData:
Arguments:
library_key (LibraryLocatorV2): a key that represents a Blockstore-based content library.
collection_key (str): identifies the collection within the library's learning package
background (bool): indicate whether the sender doesn't want to wait for handler to finish execution,
i.e., the handler can run the task in background. By default it is False.
"""

library_key = attr.ib(type=LibraryLocatorV2)
collection_key = attr.ib(type=str)
background = attr.ib(type=bool, default=False)
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@
{
"name": "collection_key",
"type": "string"
},
{
"name": "background",
"type": "boolean"
}
]
}
}
],
"namespace": "org.openedx.content_authoring.content_library.collection.created.v1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@
{
"name": "collection_key",
"type": "string"
},
{
"name": "background",
"type": "boolean"
}
]
}
}
],
"namespace": "org.openedx.content_authoring.content_library.collection.deleted.v1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@
{
"name": "collection_key",
"type": "string"
},
{
"name": "background",
"type": "boolean"
}
]
}
}
],
"namespace": "org.openedx.content_authoring.content_library.collection.updated.v1"
}
}

0 comments on commit 03dc087

Please sign in to comment.