microsoftgraph / microsoftgraph/msgraph-sdk-powershell

Get-MgTeamChannelMessage Very Slow With Large Numbers of Messages

Aperta
#2,583 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Status: Needs Investigation
Lingua principale
C#
Stelle
898
Fork
230
Merge medio
2g 5h
PR unite (30g)
31

Descrizione

Thanks for reporting the bug. Please ensure you've gone through the following checklist before opening an issue:

Describe the bug
Running the Get-MgTeamChannelMessage cmdlet against a channel with more than a hundred messages is very slow.

To Reproduce
Steps to reproduce the behavior:

  1. Select a channel with more than a couple of hundred messages.
  2. Run [array]$ChannelMessages = Get-MgTeamChannelMessage -TeamId $Team.Id -ChannelId $SelectedChannel.Id -All
  3. Wait...

Expected behavior
I expect the cmdlet to return all available messages in a reasonable period (a minute, maybe).

Debug Output

Run the problematic command with -Debug and paste the resulting debug stream below.
⚠ ATTENTION: Be sure to remove any sensitive information that may be in the logs.

Debug generates a stream of information as each message is retrieved. The retrieval of the messages gradually slows

{
  "id": "1584421259635",
  "replyToId": null,
  "etag": "1584421259635",
  "messageType": "message",
  "createdDateTime": "2020-03-17T05:00:59.635Z",
  "lastModifiedDateTime": "2020-03-17T05:00:59.635Z",
  "lastEditedDateTime": null,
  "deletedDateTime": null,
  "subject": null,
  "summary": "New tweet from @mpaez_tech about #Office365",
  "chatId": null,
  "importance": "normal",
  "locale": "en-us",
  "webUrl": "https://teams.microsoft.com/l/message/19%3A11e06f3f6cb842eba5847f4a4d637e5f%40thread.skype/1584421259635?groupId=e8cdd572-4a05-4065-90fa-832f5eb6c54e&tenantId=b662313f-14fc-43a2-9a7a-d2e27f4f3478&createdTime=1584421259635&parentMessageId=1584421259635",
  "policyViolation": null,
  "eventDetail": null,
  "from": {
    "device": null,
    "user": null,
    "application": {
      "@odata.type": "#microsoft.graph.teamworkApplicationIdentity",
      "id": "75a6c3a3-aadd-4f97-8118-99e7c2335cb2",
      "displayName": "Twitter",
      "applicationIdentityType": "office365Connector"
    }
  },
  "body": {
    "contentType": "html",
    "content": "<attachment id=\"ee5b1826ecb746a7a0f642e212b74c26\"></attachment>"
  },
  "channelIdentity": {
    "teamId": "e8cdd572-4a05-4065-90fa-832f5eb6c54e",
    "channelId": "19:11e06f3f6cb842eba5847f4a4d637e5f@thread.skype"
  },
  "attachments": [
    {
      "id": "ee5b1826ecb746a7a0f642e212b74c26",
      "contentType": "application/vnd.microsoft.teams.card.o365connector",
      "contentUrl": null,
      "content": "{\r\n  \"summary\": \"New tweet from @mpaez_tech about #Office365\",\r\n  \"text\": \"\",\r\n  \"sections\": [\r\n    {\r\n      \"text\": \"\",\r\n      \"title\": \"\",\r\n      \"activityTitle\": \"<p><a href=\\\"https://twitter.com/mpaez_tech/status/1239725545643966466\\\" title=\\\"MPaez_TECH\\\">MPaez_TECH</a></p>\",\r\n      \"activitySubtitle\": \"<p>@Netwrix</p>\",\r\n      \"activityText\": \"<p>Ready to take administration of Office 365 to a new level? Then grab this free <a href=\\\"https://twitter.com/hashtag/Office365?src=hash\\\" title=\\\"#Office365\\\">#Office365</a> guide packed with how-to’… <a href=\\\"https://twitter.com/i/web/status/1217088114705031169\\\" title=\\\"twitter.com/i/web/status/1…\\\">twitter.com/i/web/status/1…</a></p>\",\r\n      \"activityImage\": \"http://pbs.twimg.com/profile_images/973209482254848000/f6dLmD6o_normal.jpg\",\r\n      \"potentialAction\": [\r\n        {\r\n          \"hideCardOnInvoke\": false,\r\n          \"target\": \"https://api.twitter.com/\",\r\n          \"body\": \"{'commandName': 'Like', 'tweetId':'1217088114705031169'}\",\r\n          \"@type\": \"HttpPOST\",\r\n          \"@id\": \"47438c0b-a07f-4cd8-9969-b1948302e0e4\",\r\n          \"name\": \"Like\",\r\n          \"isPrimaryAction\": false\r\n        },\r\n        {\r\n          \"hideCardOnInvoke\": false,\r\n          \"target\": \"https://api.twitter.com/\",\r\n          \"body\": \"{'commandName': 'Retweet', 'tweetId':'1217088114705031169'}\",\r\n          \"@type\": \"HttpPOST\",\r\n          \"@id\": \"75646dfa-0504-47dc-a250-4b72404fa1ed\",\r\n          \"name\": \"Retweet\",\r\n          \"isPrimaryAction\": false\r\n        },\r\n        {\r\n          \"target\": [\r\n            \"https://twitter.com/Netwrix/status/1217088114705031169\"\r\n          ],\r\n          \"@context\": \"http://schema.org\",\r\n          \"@type\": \"ViewAction\",\r\n          \"name\": \"View in Twitter\",\r\n          \"isPrimaryAction\": false\r\n        }\r\n      ],\r\n      \"markdown\": true,\r\n      \"startGroup\": false\r\n    }\r\n  ]\r\n}",
      "name": null,
      "thumbnailUrl": null,
      "teamsAppId": null
    }
  ],
  "mentions": [],
  "reactions": []
},

Module Version
13.1

Environment Data
Name Value


PSVersion 7.4.1
PSEdition Core
GitCommitId 7.4.1
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

I think the problem is with the Graph API. If I use the Graph equivalent to fetch messages, I see many instances of "too many retries performed" errors. Here's the code I used to test:

$Uri = ("https://graph.microsoft.com/v1.0/teams/{0}/channels/{1}/messages?top=50" -f $Team.Id, $SelectedChannel.Id)
[array]$Data = Invoke-MgGraphRequest -Uri $Uri -Method GET
[array]$ChannelMessages = $Data.Value

[int]$Page = 1
$NextLink = $Data.'@Odata.NextLink'
While ($NextLink -ne $null) {
[int]$Page++
Write-Host ("Fetching page {0} of team channel messages..." -f $Page)
$Uri = $NextLink
[array]$Data = Invoke-MgGraphRequest -Uri $Uri -Method GET
[array]$ChannelMessages += $Data.Value
$NextLink = $Data.'@Odata.NextLink'
}

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo il rallentamento con Get-MgTeamChannelMessage usando -All su un canale con centinaia di messaggi, quindi confrontalo con l’esempio di paginazione di Invoke-MgGraphRequest e il relativo output di debug. Determina se il ritardo si trova nel cmdlet o nell’endpoint Microsoft Graph; il lavoro è concluso quando sono stati identificati una causa lato repository e una correzione riproducibile, oppure quando è stato documentato che è necessario intervenire sul servizio.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
powershell
Ambito
api, performance
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.