Skip to content

Commit

Permalink
chore: try to establish ws conn in intervals
Browse files Browse the repository at this point in the history
  • Loading branch information
siepra committed Apr 12, 2024
1 parent c2205ca commit d75af8a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/detox-ios-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
detox-ios:
timeout-minutes: 20
timeout-minutes: 25
runs-on: [macos-latest-xlarge]

steps:
Expand Down Expand Up @@ -58,7 +58,6 @@ jobs:
detox build -c ios.sim.debug.ci
- name: Run basic tests
continue-on-error: true
run: |
cd packages/mobile
detox test starter -c ios.sim.debug.ci
Expand All @@ -67,12 +66,11 @@ jobs:
run: pm2 stop METRO

- name: Take screenshot
continue-on-error: true
if: always()
run: |
/usr/bin/xcrun simctl io booted screenshot screenshot.png
- name: Upload screenshot
continue-on-error: true
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: screenshot.png
Expand Down
13 changes: 8 additions & 5 deletions packages/mobile/ios/Quiet/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,14 @@ - (void) initWebsocketConnection {
* Delay used below can't cause any race condition as websocket won't connect until data server starts listening anyway.
*/
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
NSTimeInterval delayInSeconds = 90;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void) {
[[self.bridge moduleForName:@"CommunicationModule"] sendDataPortWithPort:self.dataPort socketIOSecret:self.socketIOSecret];
});
NSArray *intervals = @[@5, @30, @60, @90];
for (NSNumber *interval in intervals) {
NSTimeInterval delayInSeconds = [interval doubleValue];
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void) {
[[self.bridge moduleForName:@"CommunicationModule"] sendDataPortWithPort:self.dataPort socketIOSecret:self.socketIOSecret];
});
}
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import { eventChannel } from 'redux-saga'
export function* startConnectionSaga(
action: PayloadAction<ReturnType<typeof initActions.startWebsocketConnection>['payload']>
): Generator {
const isAlreadyConnected = yield* select(initSelectors.isWebsocketConnected)
if (isAlreadyConnected) return

const { dataPort, socketIOSecret } = action.payload

console.log('WEBSOCKET', 'Entered start connection saga', dataPort)
Expand Down

0 comments on commit d75af8a

Please sign in to comment.