Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
sonalideshpandemsft committed Nov 28, 2024
2 parents 13d2db6 + a7bef9a commit 850f4e3
Show file tree
Hide file tree
Showing 513 changed files with 8,283 additions and 3,229 deletions.
45 changes: 45 additions & 0 deletions .changeset/shy-files-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
"@fluidframework/presence": minor
---
---
"section": feature
---

Presence updates are now batched and throttled

Presence updates are grouped together and throttled to prevent flooding the network with messages when presence values are rapidly updated. This means the presence infrastructure will not immediately broadcast updates but will broadcast them after a configurable delay.

The `allowableUpdateLatencyMs` property configures how long a local update may be delayed under normal circumstances, enabling batching with other updates. The default `allowableUpdateLatencyMs` is **60 milliseconds** but may be (1) specified during configuration of a [States Workspace](https://github.com/microsoft/FluidFramework/tree/main/packages/framework/presence#value-managers#states-workspace) or [Value Manager](https://github.com/microsoft/FluidFramework/tree/main/packages/framework/presence#value-managers#value-managers) and/or (2) updated later using the `controls` member of Workspace or Value Manager. [States Workspace](https://github.com/microsoft/FluidFramework/tree/main/packages/framework/presence#value-managers#states-workspace) configuration applies when a Value Manager does not have its own setting.

Notifications are never queued; they effectively always have an `allowableUpdateLatencyMs` of 0. However, they may be batched with other updates that were already queued.

Note that due to throttling, clients receiving updates may not see updates for all values set by another. For example,
with `Latest*ValueManagers`, the only value sent is the value at the time the outgoing batched message is sent. Previous
values set by the client will not be broadcast or seen by other clients.

#### Example

You can configure the batching and throttling behavior using the `allowableUpdateLatencyMs` property as in the following example:

```ts
// Configure a states workspace
const stateWorkspace = presence.getStates("app:v1states",
{
// This value manager has an allowable latency of 100ms.
position: Latest({ x: 0, y: 0 }, { allowableUpdateLatencyMs: 100 }),
// This value manager uses the workspace default.
count: Latest({ num: 0 }),
},
// Specify the default for all value managers in this workspace to 200ms,
// overriding the default value of 60ms.
{ allowableUpdateLatencyMs: 200 }
);

// Temporarily set count updates to send as soon as possible
const countState = stateWorkspace.props.count;
countState.controls.allowableUpdateLatencyMs = 0;
countState.local = { num: 5000 };

// Reset the update latency to the workspace default
countState.controls.allowableUpdateLatencyMs = undefined;
```
12 changes: 12 additions & 0 deletions .changeset/slick-badgers-go.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@fluidframework/presence": minor
---
---
"section": feature
---

`off` event deregistration pattern now supported

Event subscriptions within `@fluidframework/presence` may now use `off` to deregister event listeners, including initial listeners provided to `Notifications`.

Some type names have shifted within the API though no consumers are expected to be using those types directly. The most visible rename is `NotificationSubscribable` to `NotificationListenable`. Other shifts are to use types now exported thru `@fluidframework/core-interfaces` where the most notable is `ISubscribable` that is now `Listenable`.
2 changes: 1 addition & 1 deletion .changeset/thirty-walls-agree.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

Deprecation Notice: Interfaces Migrated to `@fluidframework/core-interfaces`

The following interfaces and types are now deprecated in `@fluidframework/tree`. It is recommended to import these interfaces from `@fluidframework/core-interfaces`.
The following interfaces and types are now deprecated in `@fluidframework/tree`. It is recommended to import them from either `@fluidframework/core-interfaces` or `fluid-framework`.

- Listeners
- IsListener
Expand Down
2 changes: 1 addition & 1 deletion azure/packages/azure-local-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@biomejs/biome": "~1.9.3",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.51.0",
"@fluidframework/eslint-config-fluid": "^5.4.0",
"@fluidframework/eslint-config-fluid": "^5.6.0",
"eslint": "~8.55.0",
"eslint-config-prettier": "~9.0.0",
"pm2": "^5.4.2",
Expand Down
2 changes: 1 addition & 1 deletion azure/packages/azure-service-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"@fluidframework/azure-service-utils-previous": "npm:@fluidframework/[email protected]",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.51.0",
"@fluidframework/eslint-config-fluid": "^5.4.0",
"@fluidframework/eslint-config-fluid": "^5.6.0",
"@microsoft/api-extractor": "7.47.8",
"@types/jsrsasign": "^10.5.12",
"@types/uuid": "^9.0.2",
Expand Down
2 changes: 1 addition & 1 deletion azure/packages/test/scenario-runner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"@fluid-tools/build-cli": "^0.51.0",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.51.0",
"@fluidframework/eslint-config-fluid": "^5.4.0",
"@fluidframework/eslint-config-fluid": "^5.6.0",
"@types/js-yaml": "^4.0.5",
"@types/mocha": "^9.1.1",
"@types/nock": "^9.3.0",
Expand Down
2 changes: 1 addition & 1 deletion build-tools/packages/build-cli/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ export function getFlubConfig(configPath: string, noCache = false): FlubConfig {
const config = configResult?.config as FlubConfig | undefined;

if (config === undefined) {
throw new Error("No flub configuration found.");
throw new Error(`No flub configuration found (configPath='${configPath}').`);
}

// Only version 1 of the config is supported. If any other value is provided, throw an error.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,6 @@ import { SimpleGit } from 'simple-git';
// @public
export type AdditionalPackageProps = Record<string, string> | undefined;

// @public
export class BuildProject<P extends IPackage> implements IBuildProject<P> {
constructor(searchPath: string,
upstreamRemotePartialUrl?: string | undefined);
protected readonly configFilePath: string;
readonly configuration: BuildProjectLayout;
getGitRepository(): Promise<Readonly<SimpleGit>>;
getPackageReleaseGroup(pkg: Readonly<P>): Readonly<IReleaseGroup>;
get packages(): Map<PackageName, P>;
relativeToRepo(p: string): string;
get releaseGroups(): Map<ReleaseGroupName, IReleaseGroup>;
reload(): void;
readonly root: string;
readonly upstreamRemotePartialUrl?: string | undefined;
get workspaces(): Map<WorkspaceName, IWorkspace>;
}

// @public
export const BUILDPROJECT_CONFIG_VERSION = 1;

Expand All @@ -48,6 +31,9 @@ export interface BuildProjectLayout {
// @public
export function createPackageManager(name: PackageManagerName): IPackageManager;

// @public
export function findGitRootSync(cwd?: string): string;

// @public
export interface FluidPackageJsonFields {
pnpm?: {
Expand All @@ -68,6 +54,24 @@ export function getBuildProjectConfig(searchPath: string, noCache?: boolean): {
configFilePath: string;
};

// @public
export function getChangedSinceRef<P extends IPackage>(buildProject: IBuildProject<P>, ref: string, remote?: string): Promise<{
files: string[];
dirs: string[];
workspaces: IWorkspace[];
releaseGroups: IReleaseGroup[];
packages: P[];
}>;

// @public
export function getFiles(git: SimpleGit, directory: string): Promise<string[]>;

// @public
export function getMergeBaseRemote(git: SimpleGit, branch: string, remote?: string, localRef?: string): Promise<string>;

// @public
export function getRemote(git: SimpleGit, partialUrl: string | undefined): Promise<string | undefined>;

// @public
export interface IBuildProject<P extends IPackage = IPackage> extends Reloadable {
configuration: BuildProjectLayout;
Expand Down Expand Up @@ -238,6 +242,12 @@ export interface Reloadable {
// @public
export function setVersion<J extends PackageJson>(packages: IPackage<J>[], version: SemVer): Promise<void>;

// @public
export function updatePackageJsonFile<J extends PackageJson = PackageJson>(packagePath: string, packageTransformer: (json: J) => void): void;

// @public
export function updatePackageJsonFileAsync<J extends PackageJson = PackageJson>(packagePath: string, packageTransformer: (json: J) => Promise<void>): Promise<void>;

// @public
export interface WorkspaceDefinition {
directory: string;
Expand Down
Loading

0 comments on commit 850f4e3

Please sign in to comment.