Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Commit

Permalink
Memcache tweak (#76)
Browse files Browse the repository at this point in the history
* cleanup .gitignore
* Indent and format the stacktrace on memcache connect failure
  • Loading branch information
kevmoo authored May 2, 2018
1 parent 114afdc commit e86132d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
9 changes: 2 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
.buildlog
.DS_Store
.idea
.dart_tool
.packages
.pub/
.settings/
build/
packages
pubspec.lock
.packages
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.4.4

* Improve output logging when memcache connections fail.

## 0.4.3+1

* When logging requests, the `appengine.googleapis.com/trace_id` label
Expand Down
9 changes: 8 additions & 1 deletion lib/src/appengine_internal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
library appengine.internal;

import 'dart:async';
import 'dart:convert';
import 'dart:io';

import 'package:gcloud/datastore.dart' as datastore;
Expand All @@ -17,6 +18,7 @@ import 'package:http/http.dart' as http;
import 'package:memcache/memcache.dart' as memcache;
import 'package:memcache/memcache_raw.dart' as memcache_raw;
import 'package:path/path.dart' as p;
import 'package:stack_trace/stack_trace.dart';

import 'errors.dart' as errors;
import 'logging.dart' as logging;
Expand Down Expand Up @@ -296,8 +298,13 @@ Future<memcache.Memcache> _tryMemcacheInstance(
return memcacheService;
}
} catch (e, stack) {
var stackIndented = LineSplitter
.split(Trace.format(stack, terse: true))
.map((l) => ' $l')
.join('\n');

logging.warning('Could not connect to memcache instance at $host:$port\n'
'$e\n$stack');
'$e\n$stackIndented');
}

// We were unable to connect to a memcached server running on localhost, so
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: appengine
version: 0.4.3+1
version: 0.4.4-dev
author: Dart Team <[email protected]>
description: Support for using Dart as a custom runtime on Google App Engine Flexible Environment
homepage: https://github.com/dart-lang/appengine
Expand All @@ -16,5 +16,6 @@ dependencies:
memcache: '^0.2.1+1'
path: '^1.2.0'
protobuf: '^0.5.0'
stack_trace: '^1.9.0'
dev_dependencies:
test: '^0.12.18+1'

0 comments on commit e86132d

Please sign in to comment.