Skip to content
This repository has been archived by the owner on May 15, 2019. It is now read-only.

Prevent emulator from hanging from requiring user code that doesn't exit. #103

Merged
merged 1 commit into from
May 11, 2017

Conversation

laurenzlong
Copy link
Contributor

This fixes the bug where the emulator hangs when there's something within the functions source code that causes the process to not exit. For example, if someone has the following lines at a global scope (outside of exported functions):

var firebase = require('firebase-admin')
firebase.initializeApp(...);
var databaseRef = firebase.database(); // this opens up a connection to the database, which forces the process to not exit.

The set timeout is there since otherwise there may an issue with console.log not displaying the full output due to not having enough time to clear the buffer.

@laurenzlong laurenzlong requested a review from jmdobry May 11, 2017 18:55
@codecov-io
Copy link

codecov-io commented May 11, 2017

Codecov Report

Merging #103 into master will decrease coverage by 12.4%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master     #103       +/-   ##
===========================================
- Coverage   77.36%   64.96%   -12.41%     
===========================================
  Files          52       52               
  Lines        2129     2129               
===========================================
- Hits         1647     1383      -264     
- Misses        482      746      +264
Impacted Files Coverage Δ
src/cli/controller.js 75.4% <100%> (ø) ⬆️
src/model/functions.js 18.25% <0%> (-51.46%) ⬇️
src/supervisor/supervisor.js 35.03% <0%> (-36.62%) ⬇️
src/service/rest-service.js 54.54% <0%> (-35.36%) ⬇️
src/utils/errors.js 50.9% <0%> (-16.37%) ⬇️
src/model/cloudfunction.js 84.9% <0%> (-3.78%) ⬇️
src/model/operation.js 86% <0%> (-2%) ⬇️
src/model/protos.js 80% <0%> (-1.82%) ⬇️
src/cli/commands/delete.js 88.23% <0%> (+2.94%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3bd63cd...9ed6b35. Read the comment docs.

@jmdobry jmdobry merged commit 883bc9a into master May 11, 2017
@jmdobry jmdobry deleted the require-exit branch May 11, 2017 19:07
@jmdobry
Copy link
Contributor

jmdobry commented May 11, 2017

Published in 1.0.0-alpha.19

@laurenzlong
Copy link
Contributor Author

Thanks for the speedy merge and publish @jmdobry !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants