mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-03 18:52:15 +08:00
* chore: revert tool pkg version. (#2476) * feat: update go mod pkg to latest. * revert tool pkg version. * feat: update grafana template (#2484) * feat: update web front images (#2487) * fix: import del cache (#2492) * fix:update recive name to same (#2493) * fix: fix-validate message. (#2499) * h (#2501) * refactor: refactor workflows structure. (#2511) * refactor: refactor workflows contents. * add tool workflows. * update field. * fix: remove chat error. * Fix err. * fix error. * remove cn comment. * update workflows files. * update infra config. * move workflows. * fix: solve uncorrect outdated msg get. (#2513) * refactor: refactor workflows contents. * add tool workflows. * update field. * fix: remove chat error. * Fix err. * fix error. * remove cn comment. * update workflows files. * update infra config. * move workflows. * feat: update bot. * fix: solve uncorrect outdated msg get. * update get docIDs logic. * update * update skip logic. * fix * update. * feat: update issue translator in workflows (#2521) * refactor: refactor workflows contents. * add tool workflows. * update field. * fix: remove chat error. * Fix err. * fix error. * remove cn comment. * update workflows files. * update infra config. * move workflows. * feat: update bot. * fix: solve uncorrect outdated msg get. * update get docIDs logic. * update * update skip logic. * fix * update. * feat: update issue translator. * fix: pass getMinioImageThumbnailKey error. (#2532) * refactor: refactor workflows contents. * add tool workflows. * update field. * fix: remove chat error. * Fix err. * fix error. * remove cn comment. * update workflows files. * update infra config. * move workflows. * feat: update bot. * fix: solve uncorrect outdated msg get. * update get docIDs logic. * update * update skip logic. * fix * update. * feat: update issue translator. * fix: pass getMinioImageThumbnailKey error. * docs: update CLA comments contents. (#2534) * refactor: refactor workflows contents. * add tool workflows. * update field. * fix: remove chat error. * Fix err. * fix error. * remove cn comment. * update workflows files. * update infra config. * move workflows. * feat: update bot. * fix: solve uncorrect outdated msg get. * update get docIDs logic. * update * update skip logic. * fix * update. * docs: update CLA comments contents. * update workflow file. * fix: the log key value is not aligned (#2527) * fix: GroupApplicationAcceptedNotification * fix: GroupApplicationAcceptedNotification * fix: NotificationUserInfoUpdate * cicd: robot automated Change * fix: component * fix: getConversationInfo * feat: cron task * feat: cron task * feat: cron task * feat: cron task * feat: cron task * fix: minio config url recognition error * update gomake version * update gomake version * fix: seq conversion bug * fix: redis pipe exec * fix: ImportFriends * fix: A large number of logs keysAndValues length is not even --------- Co-authored-by: withchao <withchao@users.noreply.github.com> * fix 细节 (#2525) 1、统一结构体方法 receiver,都用 pointer 2、使用 errors.Is 来做错误判断 3、修复单词拼写的错误 * Fix config (#2541) * feat: remove double quotation marks * feat: test * feat: default close prometheus * Fix: solve conversation blocking in private chat when non friendship. (#2542) * refactor: refactor workflows contents. * add tool workflows. * update field. * fix: remove chat error. * Fix err. * fix error. * remove cn comment. * update workflows files. * update infra config. * move workflows. * feat: update bot. * fix: solve uncorrect outdated msg get. * update get docIDs logic. * update * update skip logic. * fix * update. * fix: update contribute cla. * fix: solve conversations bug. * fix:get msg error (#2494) * fix:mgo delete err (#2496) * fix:doPut error (#2495) * feat: update set conversation logic. (#2544) * refactor: refactor workflows contents. * add tool workflows. * update field. * fix: remove chat error. * Fix err. * fix error. * remove cn comment. * update workflows files. * update infra config. * move workflows. * feat: update bot. * fix: solve uncorrect outdated msg get. * update get docIDs logic. * update * update skip logic. * fix * update. * feat: update set conversation logic. * content format. * update setConversation logic. * update conversation logic. * update conversation logic. * update logic. * update logic. * Groupmsg (#2548) * feat: add EnableHistoryForNewMembers * feat: change name * refactor: move first create conversation * fix: set min seq * feat: implement `SetGroupInfoEX` interface. (#2552) * refactor: refactor workflows contents. * add tool workflows. * update field. * fix: remove chat error. * Fix err. * fix error. * remove cn comment. * update workflows files. * update infra config. * move workflows. * feat: update bot. * fix: solve uncorrect outdated msg get. * update get docIDs logic. * update * update skip logic. * fix * update. * feat: implement `SetGroupInfoEX` interface. * remove null interface. * update router. * fix: set min seq (#2556) * fix:log * fix: set min seq * Fix push (#2559) * fix:log * fix: add log * fix: del return * fix: push config * feat: add push err log and extend push wait time * feat: group config * feat: add log in write binary msg * feat: Modify Prometheus data scraping ports and reserve port space. * feat: change group rpc num * feat: change log * fix: remove quotation mark * fix: read seq is written to mongo, online status redis cluster is supported (#2558) * fix: GroupApplicationAcceptedNotification * fix: GroupApplicationAcceptedNotification * fix: NotificationUserInfoUpdate * cicd: robot automated Change * fix: component * fix: getConversationInfo * feat: cron task * feat: cron task * feat: cron task * feat: cron task * feat: cron task * fix: minio config url recognition error * update gomake version * update gomake version * fix: seq conversion bug * fix: redis pipe exec * fix: ImportFriends * fix: A large number of logs keysAndValues length is not even * feat: mark read aggregate write * feat: online status supports redis cluster * feat: online status supports redis cluster * feat: online status supports redis cluster * merge * merge * read seq is written to mongo * read seq is written to mongo --------- Co-authored-by: withchao <withchao@users.noreply.github.com> * fix: invitation to join group notification opuser is null (#2562) * fix: GroupApplicationAcceptedNotification * fix: GroupApplicationAcceptedNotification * fix: NotificationUserInfoUpdate * cicd: robot automated Change * fix: component * fix: getConversationInfo * feat: cron task * feat: cron task * feat: cron task * feat: cron task * feat: cron task * fix: minio config url recognition error * update gomake version * update gomake version * fix: seq conversion bug * fix: redis pipe exec * fix: ImportFriends * fix: A large number of logs keysAndValues length is not even * feat: mark read aggregate write * feat: online status supports redis cluster * feat: online status supports redis cluster * feat: online status supports redis cluster * merge * merge * read seq is written to mongo * read seq is written to mongo * fix: invitation to join group notification --------- Co-authored-by: withchao <withchao@users.noreply.github.com> * Fix set convsation (#2564) * fix: set conversation unequal check * fix: check update list * fix: delay deleteObject func. (#2566) * refactor: refactor workflows contents. * add tool workflows. * update field. * fix: remove chat error. * Fix err. * fix error. * remove cn comment. * update workflows files. * update infra config. * move workflows. * feat: update bot. * fix: solve uncorrect outdated msg get. * update get docIDs logic. * update * update skip logic. * fix * update. * fix: delay deleteObject func. * remove unused content. * fix: memory queue optimization (#2568) * fix: GroupApplicationAcceptedNotification * fix: GroupApplicationAcceptedNotification * fix: NotificationUserInfoUpdate * cicd: robot automated Change * fix: component * fix: getConversationInfo * feat: cron task * feat: cron task * feat: cron task * feat: cron task * feat: cron task * fix: minio config url recognition error * update gomake version * update gomake version * fix: seq conversion bug * fix: redis pipe exec * fix: ImportFriends * fix: A large number of logs keysAndValues length is not even * feat: mark read aggregate write * feat: online status supports redis cluster * feat: online status supports redis cluster * feat: online status supports redis cluster * merge * merge * read seq is written to mongo * read seq is written to mongo * fix: invitation to join group notification * fix: friend op_user_id * feat: optimizing asynchronous context * feat: optimizing memamq size --------- Co-authored-by: withchao <withchao@users.noreply.github.com> * fix: fill opUser in invite tips (#2578) * fix: fill opUser in invite tips * fix: del code * feat: update group notification when set to null. (#2590) * refactor: refactor workflows contents. * add tool workflows. * update field. * fix: remove chat error. * Fix err. * fix error. * remove cn comment. * update workflows files. * update infra config. * move workflows. * feat: update bot. * fix: solve uncorrect outdated msg get. * update get docIDs logic. * update * update skip logic. * fix * update. * fix: delay deleteObject func. * remove unused content. * feat: update group notification when set to null. * update log standard. * feat: add long time push msg in prometheus (#2584) * feat: add long time push msg in prometheus * fix: log print * fix: go mod * fix: log msg * fix: log init * feat: push msg * feat: go mod ,remove cgo package * feat: remove error log * feat: test dummy push * feat:redis pool config * feat: push to kafka log * feat: supports getting messages based on session ID and seq (#2582) * fix: GroupApplicationAcceptedNotification * fix: GroupApplicationAcceptedNotification * fix: NotificationUserInfoUpdate * cicd: robot automated Change * fix: component * fix: getConversationInfo * feat: cron task * feat: cron task * feat: cron task * feat: cron task * feat: cron task * fix: minio config url recognition error * update gomake version * update gomake version * fix: seq conversion bug * fix: redis pipe exec * fix: ImportFriends * fix: A large number of logs keysAndValues length is not even * feat: mark read aggregate write * feat: online status supports redis cluster * feat: online status supports redis cluster * feat: online status supports redis cluster * merge * merge * read seq is written to mongo * read seq is written to mongo * fix: invitation to join group notification * fix: friend op_user_id * feat: optimizing asynchronous context * feat: optimizing memamq size * feat: add GetSeqMessage * feat: GroupApplicationAgreeMemberEnterNotification * feat: GroupApplicationAgreeMemberEnterNotification * feat: go.mod * feat: go.mod * feat: join group notification and get seq --------- Co-authored-by: withchao <withchao@users.noreply.github.com> * feat: implement request batch count limit. (#2591) * refactor: refactor workflows contents. * add tool workflows. * update field. * fix: remove chat error. * Fix err. * fix error. * remove cn comment. * update workflows files. * update infra config. * move workflows. * feat: update bot. * fix: solve uncorrect outdated msg get. * update get docIDs logic. * update * update skip logic. * fix * update. * fix: delay deleteObject func. * remove unused content. * update log type. * feat: implement request batch count limit. * update * update * fix: getting messages based on session ID and seq (#2595) * fix: GroupApplicationAcceptedNotification * fix: GroupApplicationAcceptedNotification * fix: NotificationUserInfoUpdate * cicd: robot automated Change * fix: component * fix: getConversationInfo * feat: cron task * feat: cron task * feat: cron task * feat: cron task * feat: cron task * fix: minio config url recognition error * update gomake version * update gomake version * fix: seq conversion bug * fix: redis pipe exec * fix: ImportFriends * fix: A large number of logs keysAndValues length is not even * feat: mark read aggregate write * feat: online status supports redis cluster * feat: online status supports redis cluster * feat: online status supports redis cluster * merge * merge * read seq is written to mongo * read seq is written to mongo * fix: invitation to join group notification * fix: friend op_user_id * feat: optimizing asynchronous context * feat: optimizing memamq size * feat: add GetSeqMessage * feat: GroupApplicationAgreeMemberEnterNotification * feat: GroupApplicationAgreeMemberEnterNotification * feat: go.mod * feat: go.mod * feat: join group notification and get seq * feat: join group notification and get seq --------- Co-authored-by: withchao <withchao@users.noreply.github.com> * feat: avoid pulling messages from sessions with a large number of max seq values of 0 (#2602) * fix: GroupApplicationAcceptedNotification * fix: GroupApplicationAcceptedNotification * fix: NotificationUserInfoUpdate * cicd: robot automated Change * fix: component * fix: getConversationInfo * feat: cron task * feat: cron task * feat: cron task * feat: cron task * feat: cron task * fix: minio config url recognition error * update gomake version * update gomake version * fix: seq conversion bug * fix: redis pipe exec * fix: ImportFriends * fix: A large number of logs keysAndValues length is not even * feat: mark read aggregate write * feat: online status supports redis cluster * feat: online status supports redis cluster * feat: online status supports redis cluster * merge * merge * read seq is written to mongo * read seq is written to mongo * fix: invitation to join group notification * fix: friend op_user_id * feat: optimizing asynchronous context * feat: optimizing memamq size * feat: add GetSeqMessage * feat: GroupApplicationAgreeMemberEnterNotification * feat: GroupApplicationAgreeMemberEnterNotification * feat: go.mod * feat: go.mod * feat: join group notification and get seq * feat: join group notification and get seq * feat: avoid pulling messages from sessions with a large number of max seq values of 0 --------- Co-authored-by: withchao <withchao@users.noreply.github.com> * refactor: improve db structure in `storage/controller` (#2604) * refactor: refactor workflows contents. * add tool workflows. * update field. * fix: remove chat error. * Fix err. * fix error. * remove cn comment. * update workflows files. * update infra config. * move workflows. * feat: update bot. * fix: solve uncorrect outdated msg get. * update get docIDs logic. * update * update skip logic. * fix * update. * fix: delay deleteObject func. * remove unused content. * update log type. * feat: implement request batch count limit. * update * update * refactor: improve db structure in `storage/controller` * feat: implement offline push using kafka (#2600) * refactor: refactor workflows contents. * add tool workflows. * update field. * fix: remove chat error. * Fix err. * fix error. * remove cn comment. * update workflows files. * update infra config. * move workflows. * feat: update bot. * fix: solve uncorrect outdated msg get. * update get docIDs logic. * update * update skip logic. * fix * update. * fix: delay deleteObject func. * remove unused content. * update log type. * feat: implement request batch count limit. * update * update * feat: implement offline push. * feat: implement batch Push spilt * update go mod * feat: implement kafka producer and consumer. * update format, * add PushMQ log. * feat: update Handler logic. * update MQ logic. * update * update * fix: update OfflinePushConsumerHandler. * feat: API supports gzip (#2609) * fix: GroupApplicationAcceptedNotification * fix: GroupApplicationAcceptedNotification * fix: NotificationUserInfoUpdate * cicd: robot automated Change * fix: component * fix: getConversationInfo * feat: cron task * feat: cron task * feat: cron task * feat: cron task * feat: cron task * fix: minio config url recognition error * update gomake version * update gomake version * fix: seq conversion bug * fix: redis pipe exec * fix: ImportFriends * fix: A large number of logs keysAndValues length is not even * feat: mark read aggregate write * feat: online status supports redis cluster * feat: online status supports redis cluster * feat: online status supports redis cluster * merge * merge * read seq is written to mongo * read seq is written to mongo * fix: invitation to join group notification * fix: friend op_user_id * feat: optimizing asynchronous context * feat: optimizing memamq size * feat: add GetSeqMessage * feat: GroupApplicationAgreeMemberEnterNotification * feat: GroupApplicationAgreeMemberEnterNotification * feat: go.mod * feat: go.mod * feat: join group notification and get seq * feat: join group notification and get seq * feat: avoid pulling messages from sessions with a large number of max seq values of 0 * feat: API supports gzip --------- Co-authored-by: withchao <withchao@users.noreply.github.com> * Fix err (#2608) * refactor: refactor workflows contents. * add tool workflows. * update field. * fix: remove chat error. * Fix err. * fix error. * remove cn comment. * update workflows files. * update infra config. * move workflows. * feat: update bot. * fix: solve uncorrect outdated msg get. * update get docIDs logic. * update * update skip logic. * fix * update. * fix: delay deleteObject func. * remove unused content. * update log type. * feat: implement request batch count limit. * update * update * feat: add rocksTimeout * feat: wrap logs * feat: add logs * feat: listen config * feat: enable listen TIME_WAIT port * feat: add logs * feat: cache batch * chore: enable fullUserCache * feat: push rpc num * feat: push err * feat: with operationID * feat: sleep * feat: change 1s * feat: change log * feat: implement Getbatch in rpcCache. * feat: print getOnline cost * feat: change log * feat: change kafka and push config * feat: del interface * feat: fix err * feat: change config * feat: go mod * feat: change config * feat: change config * feat: add sleep in push * feat: warn logs * feat: logs * feat: logs * feat: change port * feat: start config * feat: remove port reuse * feat: prometheus config * feat: prometheus config * feat: prometheus config * feat: add long time send msg to grafana * feat: init * feat: init * feat: implement offline push. * feat: batch get user online * feat: implement batch Push spilt * update go mod * Revert "feat: change port" This reverts commit 06d5e944 * feat: change port * feat: change config * feat: implement kafka producer and consumer. * update format, * add PushMQ log. * feat: get all online users and init push * feat: lock in online cache * feat: config * fix: init online status * fix: add logs * fix: userIDs * fix: add logs * feat: update Handler logic. * update MQ logic. * update * update * fix: method name * fix: update OfflinePushConsumerHandler. * fix: prommetrics * fix: add logs * fix: ctx * fix: log * fix: config * feat: change port * fix: atomic online cache status --------- Co-authored-by: Monet Lee <monet_lee@163.com> * feature: add GetConversationsHasReadAndMaxSeq interface to the WebSocket API. (#2611) * fix: lru lock (#2613) * fix: lru lock * fix: lru lock * fix: lru lock * fix: nil pointer error on close (#2618) * fix: GroupApplicationAcceptedNotification * fix: GroupApplicationAcceptedNotification * fix: NotificationUserInfoUpdate * cicd: robot automated Change * fix: component * fix: getConversationInfo * feat: cron task * feat: cron task * feat: cron task * feat: cron task * feat: cron task * fix: minio config url recognition error * update gomake version * update gomake version * fix: seq conversion bug * fix: redis pipe exec * fix: ImportFriends * fix: A large number of logs keysAndValues length is not even * feat: mark read aggregate write * feat: online status supports redis cluster * feat: online status supports redis cluster * feat: online status supports redis cluster * merge * merge * read seq is written to mongo * read seq is written to mongo * fix: invitation to join group notification * fix: friend op_user_id * feat: optimizing asynchronous context * feat: optimizing memamq size * feat: add GetSeqMessage * feat: GroupApplicationAgreeMemberEnterNotification * feat: GroupApplicationAgreeMemberEnterNotification * feat: go.mod * feat: go.mod * feat: join group notification and get seq * feat: join group notification and get seq * feat: avoid pulling messages from sessions with a large number of max seq values of 0 * feat: API supports gzip * go.mod * fix: nil pointer error on close --------- Co-authored-by: withchao <withchao@users.noreply.github.com> * feat: create group can push notification (#2617) * fix: blockage caused by listen error (#2620) * fix: GroupApplicationAcceptedNotification * fix: GroupApplicationAcceptedNotification * fix: NotificationUserInfoUpdate * cicd: robot automated Change * fix: component * fix: getConversationInfo * feat: cron task * feat: cron task * feat: cron task * feat: cron task * feat: cron task * fix: minio config url recognition error * update gomake version * update gomake version * fix: seq conversion bug * fix: redis pipe exec * fix: ImportFriends * fix: A large number of logs keysAndValues length is not even * feat: mark read aggregate write * feat: online status supports redis cluster * feat: online status supports redis cluster * feat: online status supports redis cluster * merge * merge * read seq is written to mongo * read seq is written to mongo * fix: invitation to join group notification * fix: friend op_user_id * feat: optimizing asynchronous context * feat: optimizing memamq size * feat: add GetSeqMessage * feat: GroupApplicationAgreeMemberEnterNotification * feat: GroupApplicationAgreeMemberEnterNotification * feat: go.mod * feat: go.mod * feat: join group notification and get seq * feat: join group notification and get seq * feat: avoid pulling messages from sessions with a large number of max seq values of 0 * feat: API supports gzip * go.mod * fix: nil pointer error on close * fix: listen error --------- Co-authored-by: withchao <withchao@users.noreply.github.com> * fix: go.mod (#2621) * fix: GroupApplicationAcceptedNotification * fix: GroupApplicationAcceptedNotification * fix: NotificationUserInfoUpdate * cicd: robot automated Change * fix: component * fix: getConversationInfo * feat: cron task * feat: cron task * feat: cron task * feat: cron task * feat: cron task * fix: minio config url recognition error * update gomake version * update gomake version * fix: seq conversion bug * fix: redis pipe exec * fix: ImportFriends * fix: A large number of logs keysAndValues length is not even * feat: mark read aggregate write * feat: online status supports redis cluster * feat: online status supports redis cluster * feat: online status supports redis cluster * merge * merge * read seq is written to mongo * read seq is written to mongo * fix: invitation to join group notification * fix: friend op_user_id * feat: optimizing asynchronous context * feat: optimizing memamq size * feat: add GetSeqMessage * feat: GroupApplicationAgreeMemberEnterNotification * feat: GroupApplicationAgreeMemberEnterNotification * feat: go.mod * feat: go.mod * feat: join group notification and get seq * feat: join group notification and get seq * feat: avoid pulling messages from sessions with a large number of max seq values of 0 * feat: API supports gzip * go.mod * fix: nil pointer error on close * fix: listen error * fix: listen error * update go.mod --------- Co-authored-by: withchao <withchao@users.noreply.github.com> * feat: improve searchMsg implement. (#2614) * refactor: refactor workflows contents. * add tool workflows. * update field. * fix: remove chat error. * Fix err. * fix error. * remove cn comment. * update workflows files. * update infra config. * move workflows. * feat: update bot. * fix: solve uncorrect outdated msg get. * update get docIDs logic. * update * update skip logic. * fix * update. * fix: delay deleteObject func. * remove unused content. * update log type. * feat: implement request batch count limit. * update * update * remove unused script. * feat: improve searchMsg implement. * update mongo config. * Fix lock (#2622) * fix:log * fix: lock * fix: update setGroupInfoEX field name. (#2625) * refactor: refactor workflows contents. * add tool workflows. * update field. * fix: remove chat error. * Fix err. * fix error. * remove cn comment. * update workflows files. * update infra config. * move workflows. * feat: update bot. * fix: solve uncorrect outdated msg get. * update get docIDs logic. * update * update skip logic. * fix * update. * fix: delay deleteObject func. * remove unused content. * update log type. * feat: implement request batch count limit. * update * update * fix: update setGroupInfoEX field name. * fix: update setGroupInfoEX field name (#2626) * refactor: refactor workflows contents. * add tool workflows. * update field. * fix: remove chat error. * Fix err. * fix error. * remove cn comment. * update workflows files. * update infra config. * move workflows. * feat: update bot. * fix: solve uncorrect outdated msg get. * update get docIDs logic. * update * update skip logic. * fix * update. * fix: delay deleteObject func. * remove unused content. * update log type. * feat: implement request batch count limit. * update * update * fix: update setGroupInfoEX field name. * fix: update setGroupInfoEX field name * feat: msg gateway add log (#2631) * fix: GroupApplicationAcceptedNotification * fix: GroupApplicationAcceptedNotification * fix: NotificationUserInfoUpdate * cicd: robot automated Change * fix: component * fix: getConversationInfo * feat: cron task * feat: cron task * feat: cron task * feat: cron task * feat: cron task * fix: minio config url recognition error * update gomake version * update gomake version * fix: seq conversion bug * fix: redis pipe exec * fix: ImportFriends * fix: A large number of logs keysAndValues length is not even * feat: mark read aggregate write * feat: online status supports redis cluster * feat: online status supports redis cluster * feat: online status supports redis cluster * merge * merge * read seq is written to mongo * read seq is written to mongo * fix: invitation to join group notification * fix: friend op_user_id * feat: optimizing asynchronous context * feat: optimizing memamq size * feat: add GetSeqMessage * feat: GroupApplicationAgreeMemberEnterNotification * feat: GroupApplicationAgreeMemberEnterNotification * feat: go.mod * feat: go.mod * feat: join group notification and get seq * feat: join group notification and get seq * feat: avoid pulling messages from sessions with a large number of max seq values of 0 * feat: API supports gzip * go.mod * fix: nil pointer error on close * fix: listen error * fix: listen error * update go.mod * feat: add log --------- Co-authored-by: withchao <withchao@users.noreply.github.com> * fix: update setGroupInfoEx func name and field. (#2634) * refactor: refactor workflows contents. * add tool workflows. * update field. * fix: remove chat error. * Fix err. * fix error. * remove cn comment. * update workflows files. * update infra config. * move workflows. * feat: update bot. * fix: solve uncorrect outdated msg get. * update get docIDs logic. * update * update skip logic. * fix * update. * fix: delay deleteObject func. * remove unused content. * update log type. * feat: implement request batch count limit. * update * update * fix: update setGroupInfoEx func name and field. * refactor: update groupinfoEx field. * refactor: update database name in mongodb.yml * add groupName Condition * fix: fix setConversations req fill. (#2645) * refactor: refactor workflows contents. * add tool workflows. * update field. * fix: remove chat error. * Fix err. * fix error. * remove cn comment. * update workflows files. * update infra config. * move workflows. * feat: update bot. * fix: solve uncorrect outdated msg get. * update get docIDs logic. * update * update skip logic. * fix * update. * fix: delay deleteObject func. * remove unused content. * update log type. * feat: implement request batch count limit. * update * update * fix: fix setConversations req fill. * fix: GetMsgBySeqs boundary issues (#2647) * fix: GroupApplicationAcceptedNotification * fix: GroupApplicationAcceptedNotification * fix: NotificationUserInfoUpdate * cicd: robot automated Change * fix: component * fix: getConversationInfo * feat: cron task * feat: cron task * feat: cron task * feat: cron task * feat: cron task * fix: minio config url recognition error * update gomake version * update gomake version * fix: seq conversion bug * fix: redis pipe exec * fix: ImportFriends * fix: A large number of logs keysAndValues length is not even * feat: mark read aggregate write * feat: online status supports redis cluster * feat: online status supports redis cluster * feat: online status supports redis cluster * merge * merge * read seq is written to mongo * read seq is written to mongo * fix: invitation to join group notification * fix: friend op_user_id * feat: optimizing asynchronous context * feat: optimizing memamq size * feat: add GetSeqMessage * feat: GroupApplicationAgreeMemberEnterNotification * feat: GroupApplicationAgreeMemberEnterNotification * feat: go.mod * feat: go.mod * feat: join group notification and get seq * feat: join group notification and get seq * feat: avoid pulling messages from sessions with a large number of max seq values of 0 * feat: API supports gzip * go.mod * fix: nil pointer error on close * fix: listen error * fix: listen error * update go.mod * feat: add log * fix: token parse token value * fix: GetMsgBySeqs boundary issues --------- Co-authored-by: withchao <withchao@users.noreply.github.com> * fix: the attribute version is obsolete, remove it (#2644) * refactor: update Userregister request field. (#2650) * Test Workflow (#2640) * feat: cicd * feat: cicd * fix: cicd * fix: cicd * fix: cicd * fix: cicd * fix: kick group member callback (#2643) * fix: kill group member callback * fix: change port * fix: change port * fix: route (#2654) * feat: add GetSpecifiedBlacks interface. (#2656) * Upgrade the Google Firebase version. (#2638) * Fix token (#2653) * fix: kick token * fix: kick token * fix: change config * feat: get not notify conversationIDs (#2658) * feat: get not notify conversationIDs * feat: api * fix: database * fix: change name * feat: GetPinnedConversationIDs (#2660) * feat: GetPinnedConversationIDs * feat: api * Upgrade the FCM SDK to version 4, and use the SendEach method instead of the SendAll method. (#2633) Co-authored-by: Monet Lee <monet_lee@163.com> * feat: implement GetSpecifiedUserGroupRequestInfo interface. (#2661) * feat: implement GetSpecifiedUserGroupRequestInfo interface. * update mongo config. * feat: provide the interface required by js sdk (#2664) * fix: redis support acquisition time * fix: GetActiveConversation * feat: jssdk GetConversations, GetActiveConversation * feat: jssdk GetConversations, GetActiveConversation * feat: jssdk GetConversations, GetActiveConversation * feat: jssdk GetConversations, GetActiveConversation * feat: jssdk GetConversations, GetActiveConversation * feat: improve get admin role memberIDs implement. (#2666) * feat: implement GetSpecifiedUserGroupRequestInfo interface. * update mongo config. * feat: improve get admin role memberIDs implement. * remove unused contents. * remove unused contents. * remove todo implement. * fix: fix update groupName invalid. (#2673) * refactor: change platform to platformID (#2670) * feat: don`t return nil data (#2675) Co-authored-by: Monet Lee <monet_lee@163.com> * refactor: update fields type in userStatus and check registered. (#2676) * fix: usertoken auth. (#2677) * refactor: update fields type in userStatus and check registered. * fix: usertoken auth. * update contents. * update content. * update * fix * update pb file. * feat: add friend agree after callback (#2680) * fix: sn not sort (#2682) * fix: GroupApplicationAcceptedNotification * fix: GroupApplicationAcceptedNotification * fix: NotificationUserInfoUpdate * cicd: robot automated Change * fix: component * fix: getConversationInfo * feat: cron task * feat: cron task * feat: cron task * feat: cron task * feat: cron task * fix: minio config url recognition error * update gomake version * update gomake version * fix: seq conversion bug * fix: redis pipe exec * fix: ImportFriends * fix: A large number of logs keysAndValues length is not even * feat: mark read aggregate write * feat: online status supports redis cluster * feat: online status supports redis cluster * feat: online status supports redis cluster * merge * merge * read seq is written to mongo * read seq is written to mongo * fix: invitation to join group notification * fix: friend op_user_id * feat: optimizing asynchronous context * feat: optimizing memamq size * feat: add GetSeqMessage * feat: GroupApplicationAgreeMemberEnterNotification * feat: GroupApplicationAgreeMemberEnterNotification * feat: go.mod * feat: go.mod * feat: join group notification and get seq * feat: join group notification and get seq * feat: avoid pulling messages from sessions with a large number of max seq values of 0 * feat: API supports gzip * go.mod * fix: nil pointer error on close * fix: listen error * fix: listen error * update go.mod * feat: add log * fix: token parse token value * fix: GetMsgBySeqs boundary issues * fix: sn_ not sort * fix: sn_ not sort * fix: sn_ not sort --------- Co-authored-by: withchao <withchao@users.noreply.github.com> * refactor: add GetAdminToken interface. (#2684) * refactor: add GetAdminToken interface. * update config. * fix: admin token (#2686) * fix: update workflows logic. (#2688) * refactor: add GetAdminToken interface. * update config. * update workflows logic. * fix: admin token (#2687) * update the front image (#2692) * update the front image * update version * feat: improve publish docker image workflows (#2697) * refactor: add GetAdminToken interface. * update config. * update workflows logic. * feat: improve publish docker image workflows * update condition logic. * fix: update load file logic. (#2700) * refactor: add GetAdminToken interface. * update config. * update workflows logic. * feat: improve publish docker image workflows * update condition logic. * fix: update load file logic. * feat: Msg filter (#2703) * feat: msg filter * feat: msg filter * feat: msg filter --------- Co-authored-by: Monet Lee <monet_lee@163.com> Co-authored-by: icey-yu <119291641+icey-yu@users.noreply.github.com> Co-authored-by: Kevin Lee <59052025+lgz5689@users.noreply.github.com> Co-authored-by: qinguoyi <1532979219@qq.com> Co-authored-by: chao <48119764+withchao@users.noreply.github.com> Co-authored-by: withchao <withchao@users.noreply.github.com> Co-authored-by: Mew151 <dgqypl@gmail.com> Co-authored-by: 蔡相跃 <caixiangyue007@gmail.com> Co-authored-by: 暴走的大猩猩 <Hz_testing@163.com> Co-authored-by: Libo <zhaolibo1989@foxmail.com> Co-authored-by: skiffer-git <72860476+skiffer-git@users.noreply.github.com>
401 lines
10 KiB
Go
401 lines
10 KiB
Go
// Copyright © 2023 OpenIM. All rights reserved.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package pkg
|
|
|
|
import (
|
|
"bufio"
|
|
"context"
|
|
"crypto/md5"
|
|
"encoding/hex"
|
|
"encoding/json"
|
|
"fmt"
|
|
"io"
|
|
"log"
|
|
"net/http"
|
|
"net/url"
|
|
"os"
|
|
"path/filepath"
|
|
"strconv"
|
|
"strings"
|
|
"sync"
|
|
"sync/atomic"
|
|
"time"
|
|
|
|
"github.com/openimsdk/tools/errs"
|
|
|
|
"github.com/openimsdk/protocol/third"
|
|
)
|
|
|
|
type Upload struct {
|
|
URL string `json:"url"`
|
|
Name string `json:"name"`
|
|
ContentType string `json:"contentType"`
|
|
}
|
|
|
|
type Task struct {
|
|
Index int
|
|
Upload Upload
|
|
}
|
|
|
|
type PartInfo struct {
|
|
ContentType string
|
|
PartSize int64
|
|
PartNum int
|
|
FileMd5 string
|
|
PartMd5 string
|
|
PartSizes []int64
|
|
PartMd5s []string
|
|
}
|
|
|
|
func Run(conf Config) error {
|
|
m := &Manage{
|
|
prefix: time.Now().Format("20060102150405"),
|
|
conf: &conf,
|
|
ctx: context.Background(),
|
|
}
|
|
return m.Run()
|
|
}
|
|
|
|
type Manage struct {
|
|
conf *Config
|
|
ctx context.Context
|
|
api *Api
|
|
partLimit *third.PartLimitResp
|
|
prefix string
|
|
tasks chan Task
|
|
id uint64
|
|
success int64
|
|
failed int64
|
|
}
|
|
|
|
func (m *Manage) tempFilePath() string {
|
|
return filepath.Join(m.conf.TempDir, fmt.Sprintf("%s_%d", m.prefix, atomic.AddUint64(&m.id, 1)))
|
|
}
|
|
|
|
func (m *Manage) Run() error {
|
|
defer func(start time.Time) {
|
|
log.Printf("run time %s\n", time.Since(start))
|
|
}(time.Now())
|
|
m.api = &Api{
|
|
Api: m.conf.Api,
|
|
UserID: m.conf.UserID,
|
|
Secret: m.conf.Secret,
|
|
Client: &http.Client{Timeout: m.conf.Timeout},
|
|
}
|
|
var err error
|
|
ctx := context.WithValue(m.ctx, "operationID", fmt.Sprintf("%s_init", m.prefix))
|
|
m.api.Token, err = m.api.GetAdminToken(ctx)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
m.partLimit, err = m.api.GetPartLimit(ctx)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
progress, err := ReadProgress(m.conf.ProgressPath)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
progressFile, err := os.OpenFile(m.conf.ProgressPath, os.O_CREATE|os.O_RDWR|os.O_APPEND, 0666)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
var mutex sync.Mutex
|
|
writeSuccessIndex := func(index int) {
|
|
mutex.Lock()
|
|
defer mutex.Unlock()
|
|
if _, err := progressFile.Write([]byte(strconv.Itoa(index) + "\n")); err != nil {
|
|
log.Printf("write progress err: %v\n", err)
|
|
}
|
|
}
|
|
file, err := os.Open(m.conf.TaskPath)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
m.tasks = make(chan Task, m.conf.Concurrency*2)
|
|
go func() {
|
|
defer file.Close()
|
|
defer close(m.tasks)
|
|
scanner := bufio.NewScanner(file)
|
|
var (
|
|
index int
|
|
num int
|
|
)
|
|
for scanner.Scan() {
|
|
line := strings.TrimSpace(scanner.Text())
|
|
if line == "" {
|
|
continue
|
|
}
|
|
index++
|
|
if progress.IsUploaded(index) {
|
|
log.Printf("index: %d already uploaded %s\n", index, line)
|
|
continue
|
|
}
|
|
var upload Upload
|
|
if err := json.Unmarshal([]byte(line), &upload); err != nil {
|
|
log.Printf("index: %d json.Unmarshal(%s) err: %v", index, line, err)
|
|
continue
|
|
}
|
|
num++
|
|
m.tasks <- Task{
|
|
Index: index,
|
|
Upload: upload,
|
|
}
|
|
}
|
|
if num == 0 {
|
|
log.Println("mark all completed")
|
|
}
|
|
}()
|
|
var wg sync.WaitGroup
|
|
wg.Add(m.conf.Concurrency)
|
|
for i := 0; i < m.conf.Concurrency; i++ {
|
|
go func(tid int) {
|
|
defer wg.Done()
|
|
for task := range m.tasks {
|
|
var success bool
|
|
for n := 0; n < m.conf.Retry; n++ {
|
|
ctx := context.WithValue(m.ctx, "operationID", fmt.Sprintf("%s_%d_%d_%d", m.prefix, tid, task.Index, n+1))
|
|
if urlRaw, err := m.RunTask(ctx, task); err == nil {
|
|
writeSuccessIndex(task.Index)
|
|
log.Println("index:", task.Index, "upload success", "urlRaw", urlRaw)
|
|
success = true
|
|
break
|
|
} else {
|
|
log.Printf("index: %d upload: %+v err: %v", task.Index, task.Upload, err)
|
|
}
|
|
}
|
|
if success {
|
|
atomic.AddInt64(&m.success, 1)
|
|
} else {
|
|
atomic.AddInt64(&m.failed, 1)
|
|
log.Printf("index: %d upload: %+v failed", task.Index, task.Upload)
|
|
}
|
|
}
|
|
}(i + 1)
|
|
}
|
|
wg.Wait()
|
|
log.Printf("execution completed success %d failed %d\n", m.success, m.failed)
|
|
return nil
|
|
}
|
|
|
|
func (m *Manage) RunTask(ctx context.Context, task Task) (string, error) {
|
|
resp, err := m.HttpGet(ctx, task.Upload.URL)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
defer resp.Body.Close()
|
|
reader, err := NewReader(resp.Body, m.conf.CacheSize, m.tempFilePath())
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
defer reader.Close()
|
|
part, err := m.getPartInfo(ctx, reader, reader.Size())
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
var contentType string
|
|
if task.Upload.ContentType == "" {
|
|
contentType = part.ContentType
|
|
} else {
|
|
contentType = task.Upload.ContentType
|
|
}
|
|
initiateMultipartUploadResp, err := m.api.InitiateMultipartUpload(ctx, &third.InitiateMultipartUploadReq{
|
|
Hash: part.PartMd5,
|
|
Size: reader.Size(),
|
|
PartSize: part.PartSize,
|
|
MaxParts: -1,
|
|
Cause: "batch-import",
|
|
Name: task.Upload.Name,
|
|
ContentType: contentType,
|
|
})
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
if initiateMultipartUploadResp.Upload == nil {
|
|
return initiateMultipartUploadResp.Url, nil
|
|
}
|
|
if _, err := reader.Seek(0, io.SeekStart); err != nil {
|
|
return "", err
|
|
}
|
|
uploadParts := make([]*third.SignPart, part.PartNum)
|
|
for _, part := range initiateMultipartUploadResp.Upload.Sign.Parts {
|
|
uploadParts[part.PartNumber-1] = part
|
|
}
|
|
for i, currentPartSize := range part.PartSizes {
|
|
md5Reader := NewMd5Reader(io.LimitReader(reader, currentPartSize))
|
|
if err := m.doPut(ctx, m.api.Client, initiateMultipartUploadResp.Upload.Sign, uploadParts[i], md5Reader, currentPartSize); err != nil {
|
|
return "", err
|
|
}
|
|
if md5val := md5Reader.Md5(); md5val != part.PartMd5s[i] {
|
|
return "", fmt.Errorf("upload part %d failed, md5 not match, expect %s, got %s", i, part.PartMd5s[i], md5val)
|
|
}
|
|
}
|
|
urlRaw, err := m.api.CompleteMultipartUpload(ctx, &third.CompleteMultipartUploadReq{
|
|
UploadID: initiateMultipartUploadResp.Upload.UploadID,
|
|
Parts: part.PartMd5s,
|
|
Name: task.Upload.Name,
|
|
ContentType: contentType,
|
|
Cause: "batch-import",
|
|
})
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return urlRaw, nil
|
|
}
|
|
|
|
func (m *Manage) partSize(size int64) (int64, error) {
|
|
if size <= 0 {
|
|
return 0, errs.New("size must be greater than 0")
|
|
}
|
|
if size > m.partLimit.MaxPartSize*int64(m.partLimit.MaxNumSize) {
|
|
return 0, errs.New("size must be less than", "size", m.partLimit.MaxPartSize*int64(m.partLimit.MaxNumSize))
|
|
}
|
|
if size <= m.partLimit.MinPartSize*int64(m.partLimit.MaxNumSize) {
|
|
return m.partLimit.MinPartSize, nil
|
|
}
|
|
partSize := size / int64(m.partLimit.MaxNumSize)
|
|
if size%int64(m.partLimit.MaxNumSize) != 0 {
|
|
partSize++
|
|
}
|
|
return partSize, nil
|
|
}
|
|
|
|
func (m *Manage) partMD5(parts []string) string {
|
|
s := strings.Join(parts, ",")
|
|
md5Sum := md5.Sum([]byte(s))
|
|
return hex.EncodeToString(md5Sum[:])
|
|
}
|
|
|
|
func (m *Manage) getPartInfo(ctx context.Context, r io.Reader, fileSize int64) (*PartInfo, error) {
|
|
partSize, err := m.partSize(fileSize)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
partNum := int(fileSize / partSize)
|
|
if fileSize%partSize != 0 {
|
|
partNum++
|
|
}
|
|
partSizes := make([]int64, partNum)
|
|
for i := 0; i < partNum; i++ {
|
|
partSizes[i] = partSize
|
|
}
|
|
partSizes[partNum-1] = fileSize - partSize*(int64(partNum)-1)
|
|
partMd5s := make([]string, partNum)
|
|
buf := make([]byte, 1024*8)
|
|
fileMd5 := md5.New()
|
|
var contentType string
|
|
for i := 0; i < partNum; i++ {
|
|
h := md5.New()
|
|
r := io.LimitReader(r, partSize)
|
|
for {
|
|
if n, err := r.Read(buf); err == nil {
|
|
if contentType == "" {
|
|
contentType = http.DetectContentType(buf[:n])
|
|
}
|
|
h.Write(buf[:n])
|
|
fileMd5.Write(buf[:n])
|
|
} else if err == io.EOF {
|
|
break
|
|
} else {
|
|
return nil, err
|
|
}
|
|
}
|
|
partMd5s[i] = hex.EncodeToString(h.Sum(nil))
|
|
}
|
|
partMd5Val := m.partMD5(partMd5s)
|
|
fileMd5val := hex.EncodeToString(fileMd5.Sum(nil))
|
|
return &PartInfo{
|
|
ContentType: contentType,
|
|
PartSize: partSize,
|
|
PartNum: partNum,
|
|
FileMd5: fileMd5val,
|
|
PartMd5: partMd5Val,
|
|
PartSizes: partSizes,
|
|
PartMd5s: partMd5s,
|
|
}, nil
|
|
}
|
|
|
|
func (m *Manage) doPut(ctx context.Context, client *http.Client, sign *third.AuthSignParts, part *third.SignPart, reader io.Reader, size int64) error {
|
|
rawURL := part.Url
|
|
if rawURL == "" {
|
|
rawURL = sign.Url
|
|
}
|
|
if len(sign.Query)+len(part.Query) > 0 {
|
|
u, err := url.Parse(rawURL)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
query := u.Query()
|
|
for i := range sign.Query {
|
|
v := sign.Query[i]
|
|
query[v.Key] = v.Values
|
|
}
|
|
for i := range part.Query {
|
|
v := part.Query[i]
|
|
query[v.Key] = v.Values
|
|
}
|
|
u.RawQuery = query.Encode()
|
|
rawURL = u.String()
|
|
}
|
|
req, err := http.NewRequestWithContext(ctx, http.MethodPut, rawURL, reader)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
for i := range sign.Header {
|
|
v := sign.Header[i]
|
|
req.Header[v.Key] = v.Values
|
|
}
|
|
for i := range part.Header {
|
|
v := part.Header[i]
|
|
req.Header[v.Key] = v.Values
|
|
}
|
|
req.ContentLength = size
|
|
resp, err := client.Do(req)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
defer func() {
|
|
_ = resp.Body.Close()
|
|
}()
|
|
body, err := io.ReadAll(resp.Body)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if resp.StatusCode/200 != 1 {
|
|
return fmt.Errorf("PUT %s part %d failed, status code %d, body %s", rawURL, part.PartNumber, resp.StatusCode, string(body))
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *Manage) HttpGet(ctx context.Context, url string) (*http.Response, error) {
|
|
reqUrl := url
|
|
for {
|
|
request, err := http.NewRequestWithContext(ctx, http.MethodGet, reqUrl, nil)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
DefaultRequestHeader(request.Header)
|
|
response, err := m.api.Client.Do(request)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if response.StatusCode != http.StatusOK {
|
|
_ = response.Body.Close()
|
|
return nil, fmt.Errorf("webhook get %s status %s", url, response.Status)
|
|
}
|
|
return response, nil
|
|
}
|
|
}
|