Skip to content

Commit 62c1924

Browse files
authored
Fixing the case null session state was being set as empty byte array. They are not the same. Setting session state to null properly cleans up session state in service bus. (#1228)
1 parent 2194c43 commit 62c1924

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/DurableTask.ServiceBus/Common/Abstraction/ServiceBusAbstraction.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ public async Task SetStateAsync(byte[] sessionState)
140140
{
141141
if (sessionState == null)
142142
{
143-
await this.sessionReceiver.SetSessionStateAsync(new BinaryData(new byte[] { }));
143+
// Setting session state to null is equivalent to deleting session state.
144+
// Setting session state to empty byte array is not equivalent to deleting session state.
145+
await this.sessionReceiver.SetSessionStateAsync(null);
144146
}
145147
else
146148
{

0 commit comments

Comments
 (0)